Beruflich Dokumente
Kultur Dokumente
while () {}; for thing in range(n,m) {} Function call FUNCTION name (parameter type,..) ..body.. END: Opens cursor, loops across until %NOTFOUND. FOR variables IN cursor LOOP..END LOOP;
Dat a Types.
Definition Used to store any number Used for storing text Oracle system date Stores large blocks of text Stores large blocks of binary data Smaller binary data store Uesd for row identifier Security label DEC, DECIMAL, REAL, DOUBLE- PRECISION, INTEGER, INT, SMALLINT, NATURAL, Non database types. POSITIVE, NUMERIC, BINARY- INTEGER, CHARACTER, VARCHAR, BOOLEAN, TABLE, RECORD Database types NUMBER CHAR(N), VARCHAR2(N) DATE LONG LONG RAW ROWID MLSLABEL
Function
Package Trigger
Declaring an explicit my_emprec t_emp; cursor using a record. CURSOR employee_crsr IS SELECT empid, salary FROM employee; OPEN employee_cursr; LOOP Executing explicit FETCH emloyee_crsr INTO my_emprec cursror using record. EXIT WHEN employee_crsr%NOTFOUND; IF my_emprec.t_empid .. Declaring parameters to be used at OPEN time. DECLARE .. CURSOR employee_crsr(low_end VARCHAR2, high_end VARCHAR2) IS Cursor Parameters. SELECT empid, salary FROM employee WHERE substr(lastname,1,1) BETWEEN UPPER(low_end) AND UPPER(high_end);
Package Synt ax
Specification PACKAGE package_name IS [ declarations of variables and types ] [ specifications of cursors ] [ specifications of modules ] END [ package_name ]; PACKAGE BODY package_name IS [ declarations of variables and types ] [ specification and SELECT statement of cursors ] [ specification and body of modules ] [ BEGIN executable statements ] [ EXCEPTION exception handlers ] END [ package_name ];
Pragmas
Tells the compiler to associate a particular EXCEPTION_INIT error number with an identifier you have declared as an exception in your program. Tells the compiler the purity level (freedom RESTRICT_REFERENCES from side effects) of a packaged program. Tells the PL/SQL runtime engine that package- level data should not persist SERIALLY_REUSABLE between references to that data. See Chapter 25, Tuning PL/SQL Applications for more information.
Body
script Testing script Stored procedure Stored function Stored package body Stored package specification %NOTFOUND %ROWCOUNT %FOUND %ISOPEN
.tst .sp .sf spb .sps True if fetch did not return row. Number of rows processed by this cursor Opposite of %NOTFOUND If currently open for processing then true.
User defined.
Pragmas.