PL/SQL Oracle Day 3
Objectives
Overview of Subprograms
Block Structure for Anonymous PL/SQL Blocks
Block Structure for PL/SQL Subprograms
PL/SQL Subprograms
Benefits of Subprograms
What Is a Procedure?
Syntax for Creating Procedures
Developing Procedures
Formal Versus Actual Parameters
Procedural Parameter Modes
Creating Procedures with Parameters
IN Parameters: Example
OUT Parameters: Example
Slide 16
Viewing OUT Parameters
Viewing IN OUT Parameters
Methods for Passing Parameters
DEFAULT Option for Parameters
Examples of Passing Parameters
Slide 22
Invoking a Procedure from an Anonymous PL/SQL Block
Invoking a Procedure from Another Procedure
Removing Procedures
Stored Functions
Syntax for Creating Functions
Creating a Function
Executing Functions
Advantages of User-Defined Functions in SQL Expressions
Slide 31
Locations to Call User-Defined Functions
Restrictions on Calling Functions from SQL Expressions ……..
Restrictions on Calling Functions from SQL Expressions
Restrictions on Calling from SQL
Slide 36
How Procedures and Functions Differ
Slide 38
Benefits of Stored Procedures and Functions
List All Procedures and Functions
USER_SOURCE Data Dictionary View
List the Code of Procedures and Functions
List Compilation Errors by Using SHOW ERRORS
Debugging PL/SQL Program Units
Overview of Packages
Components of a Package
Developing a Package
Creating the Package Specification
Declaring Public Constructs
Creating a Package Specification: Example
Creating the Package Body
Public and Private Constructs
Creating a Package Body: Example
Slide 54
Invoking Package Constructs
Removing Packages
Guidelines for Developing Packages
Advantages of Packages
Slide 59
Overloading
Slide 61
Using Forward Declarations
Slide 63
Restrictions on Package Functions Used in SQL
Invoking a User-Defined Package Function from a SQL Statement
Slide 66
Using Native Dynamic SQL
Execution Flow
Using the DBMS_SQL Package
Using the DBMS_DDL Package
Slide 71
Slide 72
Slide 73
Database Trigger: Example
Slide 75
Slide 76
DML Trigger Components
Slide 78
Slide 79
Firing Sequence
Slide 81
Slide 82
Slide 83
Slide 84
Slide 85
Slide 86
Slide 87
Slide 88
INSTEAD OF Triggers
Slide 90
Creating an INSTEAD OF Trigger
Slide 92
Slide 93
Benefits of Database Triggers
Viewing Trigger Information
Slide 96
Summary
Slide 98