 |
|
Oracle Tips by Burleson |
Procedures, Functions and Exception Handling
In Chapters 1 and 2 the PL/SQL code examples have
all been using anonymous or un-named blocks. This chapter introduces
two of PL/SQL’s named block types, the stored procedure and the
function. A third PL/SQL block type, the trigger, is
discussed in Chapter 5, Bulk
Operations, Packages and Triggers. The primary difference
between named and unnamed blocks is how the database handles them.
When an unnamed block is sent to the database, it compiles and
executes that block. When a named block is sent to the database, it
compiles and stores the block as a database object. To execute the
named block, it must be called.
Procedures
and functions
allow you to modularize and reuse code.
By taking commonly used code and placing it in a separate block, it
can be called many times while residing in one location. This allows
the developer to create the code once and provides one location where
the code is maintained. It also allows the programmer to encapsulate
the complexity of the application in easy to understand modules.
The above book excerpt is from:
Easy Oracle PL/SQL Programming
Get Started
Fast with Working PL/SQL Code Examples
ISBN 0-9759135-7-3
John Garmany
http://www.rampant-books.com/book_2005_1_easy_plsql.htm
|