11 Copyright س Oracle Corporation, 2000. All rights reserved. ® Overview of PL/SQL.

10
1 1 Copyright سOracle Corporation, 2000. All rights reserved. ® Overview of PL/SQL

Transcript of 11 Copyright س Oracle Corporation, 2000. All rights reserved. ® Overview of PL/SQL.

Page 1: 11 Copyright س Oracle Corporation, 2000. All rights reserved. ® Overview of PL/SQL.

1111

Copyright س Oracle Corporation, 2000. All rights reserved.®

Overview of PL/SQLOverview of PL/SQL

Page 2: 11 Copyright س Oracle Corporation, 2000. All rights reserved. ® Overview of PL/SQL.

1-1-22 Copyright س Oracle Corporation, 2000. All rights reserved.®

SQLSQLSQLSQL PL/SQLPL/SQLPL/SQLPL/SQL

ApplicationsApplications HRHR FinancialsFinancials ManufacturingManufacturing ......

ApplicationsApplications HRHR FinancialsFinancials ManufacturingManufacturing ......

Data tablesData tables

Data dictionaryData dictionary OracleOracleDatabaseDatabase

Oracle Discoverer Oracle Discoverer Oracle Discoverer Oracle Discoverer

Oracle DesignerOracle DesignerOracle DesignerOracle Designer

Oracle DeveloperOracle DeveloperOracle DeveloperOracle Developer

SQL* PlusSQL* PlusSQL* PlusSQL* Plus

Web-based Web-based applicationsapplicationsWeb-based Web-based applicationsapplications

MultitierMultitierapplicationsapplicationsMultitierMultitierapplicationsapplications

Oracle Complete SolutionOracle Complete Solution

Page 3: 11 Copyright س Oracle Corporation, 2000. All rights reserved. ® Overview of PL/SQL.

1-1-33 Copyright س Oracle Corporation, 2000. All rights reserved.®

PL/SQL Program ConstructsPL/SQL Program Constructs

AnonymousAnonymousblockblock

AnonymousAnonymousblockblock

ApplicationApplicationtriggertrigger

ApplicationApplicationtriggertrigger

Stored Stored procedure/procedure/

functionfunction

Stored Stored procedure/procedure/

functionfunction

DatabaseDatabasetriggertrigger

DatabaseDatabasetriggertrigger

ApplicationApplicationprocedure/procedure/

functionfunction

ApplicationApplicationprocedure/procedure/

functionfunction

PackagePackagePackagePackage

DECLAREDECLARE

BEGINBEGIN

EXCEPTIONEXCEPTION

END;END;

Object typeObject typeObject typeObject type

Page 4: 11 Copyright س Oracle Corporation, 2000. All rights reserved. ® Overview of PL/SQL.

1-1-44 Copyright س Oracle Corporation, 2000. All rights reserved.®

Block Structure for Anonymous PL/SQL Blocks

Block Structure for Anonymous PL/SQL Blocks

DECLARE (optional)Declare PL/SQL objects to be usedwithin this block

BEGIN (mandatory)Define the executable statements

EXCEPTION (optional)Define the actions that take place ifan error arises

END; (mandatory)

DECLARE (optional)Declare PL/SQL objects to be usedwithin this block

BEGIN (mandatory)Define the executable statements

EXCEPTION (optional)Define the actions that take place ifan error arises

END; (mandatory)

Page 5: 11 Copyright س Oracle Corporation, 2000. All rights reserved. ® Overview of PL/SQL.

1-1-55 Copyright س Oracle Corporation, 2000. All rights reserved.®

Block Structure for PL/SQL SubprogramsBlock Structure for PL/SQL Subprograms

Header

IS|AS

Declaration section

BEGIN

Executable section

EXCEPTION (optional)

Exception section

END;

Header

IS|AS

Declaration section

BEGIN

Executable section

EXCEPTION (optional)

Exception section

END;

Page 6: 11 Copyright س Oracle Corporation, 2000. All rights reserved. ® Overview of PL/SQL.

1-1-66 Copyright س Oracle Corporation, 2000. All rights reserved.®

Benefits of SubprogramsBenefits of Subprograms

• Improved maintenance

• Improved data security and integrity

• Improved performance

• Improved maintenance

• Improved data security and integrity

• Improved performance

Page 7: 11 Copyright س Oracle Corporation, 2000. All rights reserved. ® Overview of PL/SQL.

1-1-77 Copyright س Oracle Corporation, 2000. All rights reserved.®

Development EnvironmentsDevelopment Environments

• SQL*Plus uses the PL/SQL engine in the Oracle Server

• Procedure Builder uses the PL/SQL engine in the client tool or in the Oracle Server

• SQL*Plus uses the PL/SQL engine in the Oracle Server

• Procedure Builder uses the PL/SQL engine in the client tool or in the Oracle Server

Page 8: 11 Copyright س Oracle Corporation, 2000. All rights reserved. ® Overview of PL/SQL.

1-1-88 Copyright س Oracle Corporation, 2000. All rights reserved.®

Developing Procedures and Functions Using SQL*Plus

Developing Procedures and Functions Using SQL*Plus

Page 9: 11 Copyright س Oracle Corporation, 2000. All rights reserved. ® Overview of PL/SQL.

1-1-99 Copyright س Oracle Corporation, 2000. All rights reserved.®

Developing Procedures and Functions Using Oracle Procedure Builder

Developing Procedures and Functions Using Oracle Procedure Builder

Page 10: 11 Copyright س Oracle Corporation, 2000. All rights reserved. ® Overview of PL/SQL.

1-1-1010 Copyright س Oracle Corporation, 2000. All rights reserved.®

SummarySummary

In this lesson, you should have learned that:

• Anonymous blocks are unnamed PL/SQL blocks

• Subprograms are named PL/SQL blocks, declared as either procedures or functions

• There are two main PL/SQL development environments:

– SQL*Plus

– Procedure Builder

In this lesson, you should have learned that:

• Anonymous blocks are unnamed PL/SQL blocks

• Subprograms are named PL/SQL blocks, declared as either procedures or functions

• There are two main PL/SQL development environments:

– SQL*Plus

– Procedure Builder