Create a Clock Timer’s in Oracle Form

Create a Timer:

  1. Declare a variable of timer data type.     
  2. Initialize a variable with one second number data type.     
  3. Use a CREATE_TIMER built-in with the timer’s name, interval and it’s status repeats every one second on timer’s expiration.     
  4. Assign the timer’s creation built-in to a variable of timer data type.  
  5. 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. 

  1. create a non database on your form named e.g. ‘DIGITAL_TIME’ with a character data type.
  2. 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

 

Recent Posts