Professional Documents
Culture Documents
Development tools
Internet applications
SQL
SQL
Business logic Presentation and
and data business logic
PL/SQL
PL/SQL
Application
Databases servers
Java
Java
Network services
BEGIN
EXCEPTION
Database Server
Tools Constructs Constructs
Anonymous blocks END;
Anonymous blocks
Application procedures or
Stored procedures or
functions
functions
Application packages
Stored packages
Application triggers
Database triggers
Object types
Object types
A subprogram:
• Is a named PL/SQL block that can accept parameters
and be invoked from a calling environment
• Is of two types:
– A procedure that performs an action
– A function that computes a value
• Is based on standard PL/SQL block structure
• Provides modularity, reusability, extensibility,
and maintainability
• Provides easy maintenance, improved data security
and integrity, improved performance, and improved
code clarity
DECLARE (optional)
Declare PL/SQL objects to be used
within this block
BEGIN (mandatory)
Define the executable statements
EXCEPTION (optional)
Define the actions that take place if
an error or exception arises
END; (mandatory)
<header>
Subprogram Specification
IS | AS
Declaration section
BEGIN
Executable section
Subprogram Body
EXCEPTION (optional)
Exception section
END;
• Easy maintenance
• Improved data security and integrity
• Improved performance
• Improved code clarity
2 3
Scott LOG_EXECUTION
procedure
1 xxxxxxxxxxxxxx
vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
2 vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
xxxxxxxxxxxxxx
vvvvvvvvvvvvvv
3 vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
xxxxxxxxxxxxxx vvvvvvvvvvvvvv
Oracle Oracle Oracle vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
Portal Discoverer Forms vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
Developer vvvvvvvvvvvvvv
xxxxxxxxxxxxxx
vvvvvvvvvvvvvv
4
Scott