Académique Documents
Professionnel Documents
Culture Documents
1 of 3
http://www.yagc.ndo.co.uk/cheatsheets/plsql_cheatsheet.html
Symbols
; Semicolon.
% Percent sign
Statement terminator
Control Flow
IF..THEN..ELSE..ENDIF; As usual.
Implict cursor
named by
Beginning and ending multiline comment
developer.
block delimiters
Implict cusror is
Data Types.
Database types
NUMBER
CHAR(N),
VARCHAR2(N)
DATE
LONG
LONG RAW
ROWID
MLSLABEL
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
called SQL
FETCH
Function
Package
OPEN employee_cursr;
LOOP
Executing explicit
FETCH emloyee_crsr INTO my_empr
A library, consisting of a specification with
cursror using record.
EXIT
WHEN employee_crsr%NOTFOU
function/prototype signatures, and a body
IF my_emprec.t_empid ..
with actual code. eg
Usually contains declaration, execution
and exception sections.
3/13/2012 11:23 PM
2 of 3
http://www.yagc.ndo.co.uk/cheatsheets/plsql_cheatsheet.html
Specification
PACKAGE package_name
IS
[ declarations of variables and types ]
[ specifications of cursors ]
[ specifications of modules ]
END [ package_name ];
Package Syntax
DUP_VAL_ON_INDEX
TOO_MANY_ROWS
ZERO_DIVIDE
An attempt to divide by zero.
PACKAGE BODY package_name
An attempt to FETCH a cursor in
IS
ROWTYPE_MISMATCH
incompatible variable type.
[ declarations of variables and types ]
[ specification and SELECT statement of
An char type was referenced as
INVALID_NUMBER
cursors ]
number.
[ specification and body of modules ]
OTHERS
Special catchall exception.
[ BEGIN
Pragmas
executable statements ]
Tells the compiler to associate a
[ EXCEPTION
particular error number with an
exception handlers ]
EXCEPTION_INIT
identifier you have declared as a
END [ package_name ];
exception in your program.
Filename Extensions
Body
General SQL*Plus
script
.sql
Testing script
.tst
Stored procedure
.sp
Stored function
.sf
SERIALLY_REUSABLE
.sps
%ROWCOUNT
%FOUND
Opposite of %NOTFOUND
%ISOPEN
Transaction processing
Same Options as SQL COMMIT, ROLLBACK, SAVEPOINT
Transaction begins at
Rollbacks go to last COMMIT or
execution of first
SAVE_POINT
change of data.
DBMS_TRANSACTION
Exception Handling
Predefined
3/13/2012 11:23 PM
3 of 3
http://www.yagc.ndo.co.uk/cheatsheets/plsql_cheatsheet.html
User defined.
Pragmas.
3/13/2012 11:23 PM