Structure of PL/SQL Statements
All PL/SQL functions and
procedures, including packaged procedures anonymous blocks follow the following
basic layout:
PROCEDURE procedure (
parameter1 datatype [DEFAULT
default_valuel ],
parameter2 datatype [DEFAULT
default_value2] [,...]) IS
DECLARE
/* declarations */
BEGIN
/* executable code */
EXCEPTION
/* error handling */
or for a function:
FUNCTION function RETURN datatype IS
DECLARE /* declarations */
BEGIN
/* executable code */
[RETURN value]
EXCEPTION /* error handling */
END;
To create a procedure:
CREATE OR REPLACE PROCEDURE procedure IS
...
END procedure;
Or a flat file SQL script can contain simply:
BEGIN
/* executable code */
EXCEPTION
/* error handling */
END;
This is known as an 'anonymous block'