Anonymous Block. A simple procedure might look like this: CREATE PROCEDURE create_email_address ( -- Procedure heading part begins name1 VARCHAR2, name2 VARCHAR2, company VARCHAR2, email OUT VARCHAR2 ) -- Procedure heading part ends AS -- Declarative part begins (optional) error_message VARCHAR2(30) := 'Email address is too long.'; BEGIN -- Executable part begins (mandatory) email := name1 || '.' || name2 || '@' || company; EXCEPTION -- Exception-handling part begins (optional) WHEN VALUE_ERROR THEN DBMS_OUTPUT.PUT_LINE(error_message); END create_email_address; The example above shows a standalone procedure - this type of procedure is created and stored in a database schema using the CREATE PROCEDURE statement. A procedure may also be created in a PL/SQL package - this is called a Package Procedure. A procedure created in a PL/SQL anonymous block is called a nested procedure. The standalone or package procedures, stored in the database, are referred to as "stored procedures". Procedures can have three types of parameters: IN, OUT and IN OUT. An IN parameter is used as input only. An IN parameter is passed by reference, though it can be changed by the inactive program. An OUT parameter is initially NULL. The program assigns the parameter value and that value is returned to the calling program. An IN OUT parameter may or may not have an initial value. That initial value may or may not be modified by the called program. Any changes made to the parameter are returned to the calling program by default by copying but - with the NO-COPY hint - may be passed by reference. PL/SQL also supports external procedures via the Oracle database's standard ext-proc process. Package Packages are groups of conceptually linked functions, procedures, variables, PL/SQL table and record TYPE statements, constants, cursors, etc. The use of packages promotes re-use of code. Packages are composed of the package specification and an optional package body. The specification is the interface to the application; it declares the types, variables, constants, exceptions, cursors, and subprograms available. The body fully defines cursors and subprograms, and so implements the specification. Two advantages of packages are: Modular approach, encapsulation/hiding of business logic, security, performance improvement, re-usability. They support object-oriented programming features like function overloading and encapsulation. Using package variables one can declare session level (scoped) variables since variables declared in the package specification have a session scope. Trigger A database trigger is like a stored procedure that Oracle Database invokes automatically whenever a