Database Reference
In-Depth Information
Figure 24.1
PL/SQL Block
Structure and
Exception
Trapping.
The block of code in Figure 24.1 is an anonymous PL/SQL block,
which is effectively an unnamed procedure without parameters. It is exe-
cuted by the front slash (/) character, is not stored, and thus cannot be exe-
cuted again as a stored, named object.
The last two lines in Figure 24.1 before the block END statement com-
prise an error exception trap. Any errors occurring between the BEGIN
statement and the EXCEPTION statement will cause control to pass to the
EXCEPTION trap, which executes the RAISE statement. The RAISE
statement does nothing in this procedure, passing an exception to the call-
ing block. If no calling block exists, then an error called
unhandled exception
will be returned to the calling application. In our case, SQL*Plus Work-
sheet is the calling application.
24.2.2
Procedures, Functions, Triggers, and Packages
Unlike an anonymous block, stored procedures are named, compiled, and
stored in the database. They can be executed repeatedly in the future by
executing the procedure name. PL/SQL stored objects include procedures,
functions, triggers, and packages. What are the differences between these
four compiled, executable database objects? They are as follows:
Procedure
. Allows by value and by reference parameters with no
return value.
Search WWH ::




Custom Search