Overview of PL/SQL: Ibm Solutions Delivery Inc
Overview of PL/SQL: Ibm Solutions Delivery Inc
Overview of PL/SQL
Prepared by:
Sherwin O. Bautista
Course Objectives
Describe the use of PL/SQL for the developer as well as the DBA
2
IBM SOLUTIONS DELIVERY INC.
About PL/SQL
3
IBM SOLUTIONS DELIVERY INC.
PL/SQL Environment
When a user submit PL/SQL blocks from program (i.e. Pro*COBOL, Pro*C) or
other tools (i.e iSQL*Plus), the PL/SQL engine in the Oracle Server process the
PL/SQL blocks. It separates the SQL statements and sends them individually to
the SQL statement executor.
4
IBM SOLUTIONS DELIVERY INC.
Benefits of PL/SQL
Integration:
PL/SQL plays a central role in both the Oracle Server (through stored procedures, stored
functions, database triggers, and packages) and Oracle Development tools.
SQL data types can also be used in PL/SQL. PL/SQL bridges the gap between convenient
access to database technology and the need for procedural programming capabilities.
Improved Performance:
PL/SQL can improved the performance of an application. The benefits differ depending on
the execution environment.
It helps reduce network traffic because PL/SQL can used to group SQL
statements together within a single block and to send the block to the
server in a single call.
Benefits of PL/SQL
Modularize program development:
DECLARE
6
IBM SOLUTIONS DELIVERY INC.
Benefits of PL/SQL
Portability:
PL/SQL is native to the Oracle Server, a programs can be moved to any host environment
(operating system or platform) that support the Oracle Server and PL/SQL.
Identifiers:
PL/SQL can used identifiers to do the following:
Declare variables, cursors, constants, and exceptions and then use them in SQL and
procedural statements.
Declare variables belonging to scalar, reference, composite, and large object (LOB) data
types.
Declare variables dynamically based on the data structure of tables and columns in the
database.
7
IBM SOLUTIONS DELIVERY INC.
Benefits of PL/SQL
8
IBM SOLUTIONS DELIVERY INC.
Benefits of Subprograms
Easy maintenance:
Routines online without interfering with other users.
Control indirect access to database objects from non-privileged users with security
privileges
Ensure that related actions are performed together, or not at all, by funneling activity
for related tables through a single path.
9
IBM SOLUTIONS DELIVERY INC.
Benefits of Subprograms
Improved performance:
Avoid reparsing for multiple users by exploiting the shared SQL area
Reduce the number of calls to the database and decrease network traffic by
bundling commands.
Using appropriate identifier names to describe the action of the routines reduces the
need for comments and enhances the clarity of the code.
10
IBM SOLUTIONS DELIVERY INC.
http://www.ibm.com/software/data/db2
11