Create a Timer:
- Declare a variable of timer data type.
- Initialize a variable with one second number data type.
- Use a CREATE_TIMER built-in with the timer’s name, interval and it’s status repeats every one second on timer’s expiration.
- Assign the timer’s creation built-in to a variable of timer data type.
- Paste the following code in WHEN-NEW-FORM-INSTANCE trigger Form-Level:
DECLARE
timer_id Timer;
one_sec NUMBER (5) := 1000; — 1 second in milliseconds
BEGIN
timer_id := CREATE_TIMER (‘MYTIMER’, one_sec, REPEAT);
END;
Delete a Timer:
In timer’s creation and expiration one second created, executed in regards to current system date. It repeats itself endlessly.
- create a non database on your form named e.g. ‘DIGITAL_TIME’ with a character data type.
- Paste the following code in When-Timer-Expired Trigger Form-Level :
BEGIN
:DIGITAL_TIME := TO_CHAR(SYSDATE , ‘HH12:MI:SS AM’);
SYNCHRONIZE;
END;
If you want to display the system date and time in the same field correctly, you have to change the data type from character datatype to DATE TIME datatype and change the format mask for date and time.
Now, compile, generate and run the form, if it works then save your form safely