oracle forms : timers
TRANSCRIPT
Working With Timers
http://blog.ebiztechnics.com
Objectives
• Describe Timer• Usage of timer• Create timer• Modify timer• Handle timer expiration• Delete timer
http://blog.ebiztechnics.com
Timers
• What is a timer?A timer is an "internal time clock" that you programmatically createto perform an action each time the timer expires.
• Built-ins used:– FIND_TIMER– CREATE_TIMER– SET_TIMER– DELETE_TIMER– GET_APPLICATION_PROPERTY
(TIMER_NAME)
http://blog.ebiztechnics.com
Usage of Timers
• WHEN-TIMER-EXPIRED Trigger.
• Using timers:– Periodically query, commit, or rollback– Show “About…” information at startup– Display ticker messages– Display running time
http://blog.ebiztechnics.com
Handling Timer ExpirationStart
(R)
T1
When-Timer-Expired (A)Queryissued
Timer T2expired T2
Timer T1expired
(R)
T2,T1
CompletedWhen-Timer-Expired (T2)
When-Timer-Expired (T1)
Timer T1created
Timer T2created
Timer T1expired
http://blog.ebiztechnics.com
Creating a Timer
• Syntax:
• Example:
CREATE_TIMER (timer_name, milliseconds, iterate)
v_timer_id := CREATE_TIMER (‘Time1’, 300,repeat);
http://blog.ebiztechnics.com
Modifying a Timer
• Syntax:
• Example:
SET_TIMER (timer_name, milliseconds, iterate)SET_TIMER (timer_id, milliseconds, iterate)
SET_TIMER (‘Time1’, no_change, no_repeat);
http://blog.ebiztechnics.com
Delete Timer
• Syntax:
DELETE_TIMER (timer_name)DELETE_TIMER (timer_id)
...IF NOT ID_NULL (FIND_TIMER (‘Time1’)) THEN
DELETE_TIMER (’Time1’);END IF;...
http://blog.ebiztechnics.com
Find Timer Expiration
• Example:
IF GET_APPLICATION_PROPERTY(TIMER_NAME)=‘Time1’ THEN
Select . . . . .
From t1;
ELSE
:control.time_disp:=:SYSTEM.CURRENT_DATETIME;
END IF;
http://blog.ebiztechnics.com
Summary
• Create and modify a timer with built-in functions– FIND_TIMER– CREATE_TIMER– SET_TIMER– DELETE_TIMER– GET_APPLICATION_PROPERTY
(TIMER_NAME)
http://blog.ebiztechnics.com