Creating an INSTEAD OF Trigger 10-21
Comparison of Database Triggers and Stored Procedures 10-24
Comparison of Database Triggers and Oracle Forms Triggers 10-25
Managing Triggers 10-26
Removing Triggers 10-27
Testing Triggers 10-28
Summary 10-29
Practice 10: Overview 10-30
Oracle University and ORACLE CORPORATION use only
11 Applications for Triggers
Objectives 11-2
Creating Database Triggers 11-3
Creating Triggers on DDL Statements 11-4
Creating Triggers on System Events 11-5
LOGON and LOGOFF Triggers: Example 11-6
CALL Statements 11-7
Reading Data from a Mutating Table 11-8
Mutating Table: Example 11-9
Benefits of Database Triggers 11-11
Managing Triggers 11-12
Business Application Scenarios for Implementing Triggers 11-13
Viewing Trigger Information 11-14
Using USER_TRIGGERS 11-15
Listing the Code of Triggers 11-16
Summary 11-17
Practice 11: Overview 11-18
12 Understanding and Influencing the PL/SQL Compiler
Objectives 12-2
Native and Interpreted Compilation 12-3
Features and Benefits of Native Compilation 12-4
Considerations When Using Native Compilation 12-5
Parameters Influencing Compilation 12-6
Switching Between Native and Interpreted Compilation 12-7
Viewing Compilation Information in the Data Dictionary 12-8
Using Native Compilation 12-9
Compiler Warning Infrastructure 12-10
Setting Compiler Warning Levels 12-11
Guidelines for Using PLSQL_WARNINGS 12-12
DBMS_WARNING Package 12-13
x
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Using DBMS_WARNING Procedures 12-14
Using DBMS_WARNING Functions 12-15
Using DBMS_WARNING: Example 12-16
Summary 12-18
Practice 12: Overview 12-19
Appendix A: Practice Solutions
Oracle University and ORACLE CORPORATION use only
Appendix B: Table Descriptions and Data
Appendix C: Studies for Implementing Triggers
Appendix D: Review of PL/SQL
Appendix E: Oracle JDeveloper
Appendix F: Using SQL Developer
Index
Additional Practices
Additional Practice: Solutions
Additional Practices: Table Descriptions and Data
xi
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle University and ORACLE CORPORATION use only
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Preface
Oracle University and ORACLE CORPORATION use only
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Oracle University and ORACLE CORPORATION use only
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Profile
Before You Begin This Course
Before you begin this course, you have thorough knowledge of SQL and SQL
Developer, as well as working experience in developing applications. Prerequisites
are any of the following Oracle University courses or combinations of courses:
Oracle Database 10g: Introduction to SQL
Oracle Database 10g: SQL Fundamentals I and Oracle Database 10g: SQL
Fundamentals II
Oracle Database 10g: SQL and PL/SQL Fundamentals
Oracle University and ORACLE CORPORATION use only
Oracle Database 10g: PL/SQL Fundamentals
How This Course Is Organized
Oracle Database 10g: Develop PL/SQL Program Units is an instructor-led course
featuring lectures and hands-on exercises. Online demonstrations and written
practice sessions reinforce the concepts and skills that are introduced.
Preface - 3
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Related Publications
Oracle Publications
Title Part Number
Oracle Database Application Developer’s Guide B10795-01
– Fundamentals (10g Release 1)
Oracle Database Application Developer’s Guide B10796-01
– Large Objects (10g Release 1)
PL/SQL Packages and Types Reference (10g Release 1) B10802-01
Oracle University and ORACLE CORPORATION use only
PL/SQL User’s Guide and Reference (10g Release 1) B10807-01
Additional Publications
• System release bulletins
• Installation and user’s guides
• read.me files
• International Oracle User’s Group (IOUG) articles
• Oracle Magazine
Preface - 4
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Typographic Conventions
The following two lists explain Oracle University typographical conventions for
words that appear within regular text or within code samples.
1. Typographic Conventions for Words Within Regular Text
Convention Object or Term Example
Courier New User input; Use the SELECT command to view
commands; information stored in the LAST_NAME
column, table, and column of the EMPLOYEES table.
Oracle University and ORACLE CORPORATION use only
schema names;
functions; Enter 300.
PL/SQL objects;
paths Log in as scott
Initial cap Triggers; Assign a When-Validate-Item trigger to
user interface object the ORD block.
names, such as
button names Click the Cancel button.
Italic Titles of For more information on the subject see
courses and Oracle SQL Reference
manuals; Manual
emphasized
words or phrases; Do not save changes to the database.
placeholders or
variables Enter hostname, where
hostname is the host on which the
password is to be changed.
Quotation marks Lesson or module This subject is covered in Lesson 3,
titles referenced “Working with Objects.”
within a course
Preface - 5
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Typographic Conventions (continued)
2. Typographic Conventions for Words Within Code Samples
Convention Object or Term Example
Uppercase Commands, SELECT employee_id
functions FROM employees;
Lowercase, Syntax variables CREATE ROLE role;
italic
Oracle University and ORACLE CORPORATION use only
Initial cap Forms triggers Form module: ORD
Trigger level: S_ITEM.QUANTITY
item
Trigger name: When-Validate-Item
. . .
Lowercase Column names, . . .
table names, OG_ACTIVATE_LAYER
filenames, (OG_GET_LAYER ('prod_pie_layer'))
PL/SQL objects . . .
SELECT last_name
FROM employees;
Bold Text that must CREATE USER scott
be entered by a IDENTIFIED BY tiger;
user
Preface - 6
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Additional
Practices
Oracle University and ORACLE CORPORATION use only
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
COMPUTER IS STRICTLY PROHIBITED
Additional Practices: Overview
These additional practices are provided as a supplement to the course Oracle Database 10g:
Develop PL/SQL Program Units. In these practices, you apply the concepts that you learned
in the course.
The additional practices comprise two parts:
Part A provides supplemental exercises to create stored procedures, functions, packages, and
triggers, and to use the Oracle-supplied packages with SQL Developer as the development
environment. The tables used in this portion of the additional practice include EMPLOYEES,
JOBS, JOB_HISTORY, and DEPARTMENTS.
Oracle University and ORACLE CORPORATION use only
Part B is a case study that can be completed at the end of the course. This part supplements
the practices for creating and managing program units. The tables used in the case study are
based on a video database and contain the TITLE, TITLE_COPY, RENTAL,
RESERVATION, and MEMBER tables.
An entity relationship diagram is provided at the start of part A and part B. Each entity
relationship diagram displays the table entities and their relationships. More detailed
definitions of the tables and the data contained in them is provided in the appendix titled
“Additional Practices: Table Descriptions and Data.”
THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS
Oracle Database 10g: IS
COMPUTER Develop PL/SQL
STRICTLY Program Units AP-2
PROHIBITED