Sunteți pe pagina 1din 12

I

Overview of PL/SQL

Copyright © Oracle Corporation, 2001. All rights reserved.


Course Objectives

After completing this course, you should be able to


do the following:
• Describe the purpose of PL/SQL
• Describe the use of PL/SQL for the developer as
well as the DBA
• Explain the benefits of PL/SQL
• Create, execute, and maintain procedures,
functions, packages, and database triggers
• Manage PL/SQL subprograms and triggers
• Describe Oracle supplied packages
• Manipulate large objects (LOBs)

I-2 Copyright © Oracle Corporation, 2001. All rights reserved.


About PL/SQL

• PL/SQL is the procedural extension to SQL with


design features of programming languages.
• Data manipulation and query statements of SQL
are included within procedural units of code.

I-3 Copyright © Oracle Corporation, 2001. All rights reserved.


PL/SQL Environment

PL/SQL engine
PL/SQL Procedural
PL/SQL PL/SQL statement
block block SQL
executor

SQL statement executor

Oracle server

I-4 Copyright © Oracle Corporation, 2001. All rights reserved.


Benefits of PL/SQL

Integration

Application

Shared Oracle server


library

I-5 Copyright © Oracle Corporation, 2001. All rights reserved.


Benefits of PL/SQL

Improved performance
SQL
SQL
Application Other DBMSs
SQL
SQL

SQL
IF...THEN
Oracle with
Application SQL
PL/SQL
ELSE
SQL
END IF;
SQL

I-6 Copyright © Oracle Corporation, 2001. All rights reserved.


Benefits of PL/SQL

Modularize program development


DECLARE


BEGIN


EXCEPTION

END;

I-7 Copyright © Oracle Corporation, 2001. All rights reserved.


Benefits of PL/SQL

• PL/SQL is portable.
• You can declare variables.

I-8 Copyright © Oracle Corporation, 2001. All rights reserved.


Benefits of PL/SQL

• You can program with procedural language control


structures.
• PL/SQL can handle errors.

I-9 Copyright © Oracle Corporation, 2001. All rights reserved.


Benefits of Subprograms

• Easy maintenance
• Improved data security and integrity
• Improved performance
• Improved code clarity

I-10 Copyright © Oracle Corporation, 2001. All rights reserved.


Invoking Stored Procedures
and Functions

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

I-11 Copyright © Oracle Corporation, 2001. All rights reserved.


Summary
• PL/SQL is an extension to SQL.
• Blocks of PL/SQL code are passed to and
processed by a PL/SQL engine.
• Benefits of PL/SQL:
– Integration
– Improved performance
– Portability
– Modularity of program development
• Subprograms are named PL/SQL blocks, declared
as either procedures or functions.
• You can invoke subprograms from different
environments.

I-12 Copyright © Oracle Corporation, 2001. All rights reserved.

S-ar putea să vă placă și