Upload
ambesh-thakur
View
113
Download
4
Tags:
Embed Size (px)
Citation preview
Copyright © Oracle Corporation, 2001. All rights reserved.
Overview of PL/SQL
Copyright © Oracle Corporation, 2001. All rights reserved.I-2
Course ObjectivesCourse Objectives
After completing this course, you should be able todo 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)
After completing this course, you should be able todo 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)
Copyright © Oracle Corporation, 2001. All rights reserved.I-3
About PL/SQLAbout 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.
• 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.
Copyright © Oracle Corporation, 2001. All rights reserved.I-4
PL/SQL EnvironmentPL/SQL Environment
PL/SQLblock
PL/SQL engine
Oracle server
Proceduralstatementexecutor
PL/SQL
SQL
SQL statement executor
PL/SQLblock
Copyright © Oracle Corporation, 2001. All rights reserved.I-5
Benefits of PL/SQLBenefits of PL/SQL
IntegrationIntegration
Application
Oracle serverSharedlibrary
Copyright © Oracle Corporation, 2001. All rights reserved.I-6
Benefits of PL/SQLBenefits of PL/SQL
Improved performanceImproved performance
Application Other DBMSs
ApplicationOracle with
PL/SQL
SQLSQL
SQLSQL
SQLIF...THEN
SQLELSE
SQLEND IF;SQL
Copyright © Oracle Corporation, 2001. All rights reserved.I-7
Benefits of PL/SQLBenefits of PL/SQL
Modularize program developmentModularize program development
DECLARE
BEGIN
END;
EXCEPTION
………
Copyright © Oracle Corporation, 2001. All rights reserved.I-8
Benefits of PL/SQLBenefits of PL/SQL
• PL/SQL is portable.• You can declare variables.• PL/SQL is portable.• You can declare variables.
Copyright © Oracle Corporation, 2001. All rights reserved.I-9
Benefits of PL/SQLBenefits of PL/SQL
• You can program with procedural language control structures.
• PL/SQL can handle errors.
• You can program with procedural language control structures.
• PL/SQL can handle errors.
Copyright © Oracle Corporation, 2001. All rights reserved.I-10
Benefits of Subprograms
• Easy maintenance• Improved data security and integrity• Improved performance• Improved code clarity
Copyright © Oracle Corporation, 2001. All rights reserved.I-11
Invoking Stored Procedures and Functions
xxxxxxxxxxxxxxvvvvvvvvvvvvvvxxxxxxxxxxxxxxvvvvvvvvvvvvvvxxxxxxxxxxxxxxvvvvvvvvvvvvvvxxxxxxxxxxxxxxvvvvvvvvvvvvvvxxxxxxxxxxxxxxvvvvvvvvvvvvvv
LOG_EXECUTIONprocedure
Scott
xxxxxxxxxxxxxxvvvvvvvvvvvvvvxxxxxxxxxxxxxxvvvvvvvvvvvvvvxxxxxxxxxxxxxxvvvvvvvvvvvvvvxxxxxxxxxxxxxxvvvvvvvvvvvvvvxxxxxxxxxxxxxxvvvvvvvvvvvvvv
Scott
Oracle Forms
Developer
Oracle Discoverer
Oracle Portal
1
2
3
4
Copyright © Oracle Corporation, 2001. All rights reserved.I-12
SummarySummary• 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.
• 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.