Download presentation
Presentation is loading. Please wait.
1
13 Copyright © 2004, Oracle. All rights reserved. Introduction to Triggers
2
13-2 Copyright © 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: Define triggers Identify the different trigger categories Plan the type and scope of triggers in a form Describe the properties that affect the behavior of a trigger
3
13-3 Copyright © 2004, Oracle. All rights reserved. Trigger Overview Event Trigger types Queries Validation Navigation Interaction Internal event Errors/Messages Others PL/SQL Fire PL/SQL Which trigger would you use to perform complex calculations after a user enters data into an item?
4
13-4 Copyright © 2004, Oracle. All rights reserved. Grouping Triggers into Categories Triggers may be grouped into functional categories: Block processing triggers Interface event triggers Master-detail triggers Message handling triggers Navigational triggers Query-time triggers Transactional triggers Validation triggers Triggers may be grouped into categories based on name: When-Event triggers On-Event triggers Pre-Event triggers Post-Event triggers Key triggers
5
13-5 Copyright © 2004, Oracle. All rights reserved.
6
13-6 Copyright © 2004, Oracle. All rights reserved. Defining Trigger Components What event?What action? What level? Type Code Scope
7
13-7 Copyright © 2004, Oracle. All rights reserved. Trigger Type Pre- Post- When- On- Key- User-named Type Code Scope What event?
8
13-8 Copyright © 2004, Oracle. All rights reserved. Trigger Type Forms Builder Trigger Types
9
13-9 Copyright © 2004, Oracle. All rights reserved. Trigger Code Statements PL/SQL User subprograms Built-in subprograms Type Code Scope What action?
10
13-10 Copyright © 2004, Oracle. All rights reserved. Trigger Scope Levels Form Block Item Code Scope Type What level?
11
13-11 Copyright © 2004, Oracle. All rights reserved. Trigger Scope Event Order Date
12
13-12 Copyright © 2004, Oracle. All rights reserved. Specifying Execution Hierarchy Form level Block level Item level On-Message On-Error EH = After EH = Before EH = Override 1 2 3 4 Event
13
13-13 Copyright © 2004, Oracle. All rights reserved.
14
13-14 Copyright © 2004, Oracle. All rights reserved. Summary In this lesson, you should have learned that: Triggers are event-activated program units You can categorize triggers based on function or name to help you understand how they work Trigger components are: –Type: Defines the event that fires the trigger –Code: The actions a trigger performs –Scope: Specifies the level (form, block, or item) at which the trigger is defined The Execution Hierarchy trigger property alters the firing sequence of a trigger
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.