Monday 19 August 2013

Structure of PL/SQL-Blocks

PL/SQL is a block-structured language. Each block builds a (named) program unit, and blocks can be nested. Blocks that build a procedure, a function, or a package must be named. A PL/SQL block has an optional declare section, a part containing PL/SQL statements, and an optional exception-handling part. Thus the structure of a PL/SQL looks as follows (brackets [ ] enclose optional parts):
[]
[declare
]
begin
[exception
]
end;
The block header specifies whether the PL/SQL block is a procedure, a function, or a package.
If no header is specified, the block is said to be an anonymous PL/SQL block. Each PL/SQL
block again builds a PL/SQL statement. Thus blocks can be nested like blocks in conventional
programming languages. The scope of declared variables (i.e., the part of the program in which
one can refer to the variable) is analogous to the scope of variables in programming languages
such as C or Pascal.

No comments:

Post a Comment