12
Copyright © Oracle Corporation, 2001. All rights reserved. Overview of PL/SQL

Oracle Introduction to PLSQL

Embed Size (px)

Citation preview

Page 1: Oracle Introduction to PLSQL

Copyright © Oracle Corporation, 2001. All rights reserved.

Overview of PL/SQL

Page 2: Oracle Introduction to PLSQL

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)

Page 3: Oracle Introduction to PLSQL

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.

Page 4: Oracle Introduction to PLSQL

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

Page 5: Oracle Introduction to PLSQL

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

Benefits of PL/SQLBenefits of PL/SQL

IntegrationIntegration

Application

Oracle serverSharedlibrary

Page 6: Oracle Introduction to PLSQL

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

Page 7: Oracle Introduction to PLSQL

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

………

Page 8: Oracle Introduction to PLSQL

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.

Page 9: Oracle Introduction to PLSQL

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.

Page 10: Oracle Introduction to PLSQL

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

Benefits of Subprograms

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

Page 11: Oracle Introduction to PLSQL

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

Page 12: Oracle Introduction to PLSQL

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.