0% found this document useful (0 votes)
232 views

Oracle Forms Triggers: Mr. Sandeep M Shinde

Triggers are sets of statements that execute when certain actions occur. There are different types of triggers based on the event level and timing. Some important triggers include when_new_form_instance to initialize variables, on_error to handle runtime errors, pre_insert and pre_update to set field values implicitly, and when_validate_item to validate item data. Triggers execute at different times like pre-event, during the event, or post-event. System variables are also available to access information about the current block and item.

Uploaded by

Facundo Bodner
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
232 views

Oracle Forms Triggers: Mr. Sandeep M Shinde

Triggers are sets of statements that execute when certain actions occur. There are different types of triggers based on the event level and timing. Some important triggers include when_new_form_instance to initialize variables, on_error to handle runtime errors, pre_insert and pre_update to set field values implicitly, and when_validate_item to validate item data. Triggers execute at different times like pre-event, during the event, or post-event. System variables are also available to access information about the current block and item.

Uploaded by

Facundo Bodner
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

www.eTutorInfotech.com Mr.

Sandeep M Shinde
8308800428/99309754 eTutorInfotech@gmail.com

Oracle Forms Triggers


Trigger is a set of statements that executed when an action take a place.
There is some types depends on event level (Form, Block, Record, Item) for Triggers, if
the same trigger found in more than one level then the lowest level will run ex:
when_validate_item on (form, block, item) then only the item level will run. The second
types of triggers depends on the time for run (pre, when, post, on, custom) each type is
different from other in time to run.
Pre: before the chosen event ex: pre_query (before execute the query).
When: during the event ex: when_validate_item (when item data validation).
Post: after the event ex: Post_Query (after execution of query).
On: this type unpredictable cause we don’t know when it will run, may during a trigger
execution or just when you try to enter data in protected field.
Custom: you can add a custom trigger and call it from any were
(execute_trigger(‘custome_tri’);)

Here are some of the most important trigger can the programmer use in any program:

trigger exe purpose level ex


1 When_new_form_instance 1 To initial some form :global.datetime:=sysdate;
variable values :time_text:=sysdate;
:user_text:=user;
2 On_error 1 To handle error during form If error_code = 14015 then
run time, or to display Message(‘‫;)’ال يمكنك الكتابة في هذا الحقل‬
it in good way to user. Message(‘‫;)’ال يمكنك الكتابة في هذا الحقل‬
End if;
3 Pre_insert, pre_update 1 To set some fields Form, :username := user;
value implicitly in Block
code.
4 Post_query Return To get description for Block Select ename into :name_txt
rows code field. From emp where empno=:empno;
5 Pre_query 1 To set default where to block Set_block_property
block (‘block1’,default_where,’deptno=1’);
6 When_new_record_instance 1 To set initial values to block Select max(empno)+1 into :empno
block items when add From emp;
new record.
7 When_validate_item 1 To get description for item Select ename into :name_txt
the code entered in From emp where empno=:empno;
item.
8 Post_change 1 Executes only when item Select ename into :name_txt
item value is changed. From emp where empno=:empno;
**Note: we preferred
When_validate_item, cause it’s
execute every time in item.
9 Key_next_item 1 Executes when you item Select ename into :name_txt
press enter-key after From emp where empno=:empno;
entered value in item. **Note: it’s executes instead of
going to the next item (:name_txt).
10 When_button_pressed 1 Executes when mouse item Message(‘clicked’);pause;
www.eTutorInfotech.com Mr. Sandeep M Shinde
8308800428/99309754 eTutorInfotech@gmail.com

click or by keyboard **Note: set property MOUSE


enter-key. NAVIGATE to NO
11 When_checkbox_changed 1 When you change the item If :box = 1 then
selection of radio, Message(‘open’);
checkbox. End if;

System Variables
1 : System.current_block Get the current block.
2 : SYSTEM.current_item Get the current item.
3 :System.block_status New, enter-query, changed

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy