Wednesday, August 17, 2016

PLSQL - Blocks


PLSQL Block Structure

DECLARE
--declarations (variables, constants, user defined types, cursors)
BEGIN
--processing /execution (SQL Statements, PLSQL statements)
EXCEPTION
--alternative actions to be performed when exceptions occurs in processing
END;

DECLARE, EXCEPTION are optional sections.
BEGIN.. END are mandatory sections.

Types of Blocks

Anonymous block.- Block without name
Procedure -Named PLSQL object /subprogram
Function- Named PLSQL object/subprogram

Typically use a procedure to perform an action and a function to compute and return a value.

Subprograms are stored in database and can be executed many times. Anonymous block is a onetime execution program and doesn't store in database.

Featured Post

Will the data from Oracle Database be lost after formatting the system in which it is installed?

So Someone asked me a question,  Will the data from Oracle Database be lost after formatting the system in which it is installed? Since the ...

Popular Posts