Creating Timer in Oracle D2k / Forms 6i and Displaying a Clock

This is about timer in D2k

An external clock can be constructed using timers. Timers correspond to internal clocks, which have a specific time period. When the specified duration expires, the timer can either perform an action once and stop or repeat the action regularly every time the timer expires. Timer duration is always in milliseconds. Timers are created using the CREATE_TIMER built in and require a WHEN-TIMER-EXPIRED trigger to be written at the form level. This trigger fires every time the timer expires.

Using REPEAT Timers

Let's create a display item, CURRENT_TIME, in the horizontal toolbar canvas CANVAS_TOOLBARcreated earlier. This item shows the time in HH24:MI:SS format and updates itself every second (the timer duration).
In the WHEN-NEW-FORM-INSTANCE trigger, create a timer named CLOCK_TIMER, which iterates after every one second and populates the CURRENT_TIME item with the system date in HH24:MI:SSformat. The code is as follows:
 
DECLARE

   timer_id TIMER;

   one_second NUMBER := 1000;

BEGIN

   timer_id := FIND_TIMER('CLOCK_TIMER');

   IF NOT ID_NULL(timer_id) THEN

     DELETE_TIMER(timer_id);

   ELSE

     timer_id := CREATE_TIMER('CLOCK_TIMER',one_second, REPEAT);

   END IF;

     SELECT  TO_CHAR(SYSDATE,'HH24:MI:SS')

     INTO   :toolbar.current_time

     FROM   DUAL;

   EXCEPTION WHEN OTHERS THEN

     MESSAGE(TO_CHAR(SQLCODE)||''||SQLERRM);

END;
Create a WHEN-TIMER-EXPIRED trigger as follows:
 
DECLARE

   timer_name VARCHAR2(30);

BEGIN

   timer_name := GET_APPLICATION_PROPERTY(TIMER_NAME);

   IF  timer_name = 'CLOCK_TIMER' THEN

      SELECT  TO_CHAR(SYSDATE,'HH24:MI:SS')

      INTO   :toolbar.current_time

      FROM   DUAL;

   END IF;

   EXCEPTION WHEN OTHERS THEN

      MESSAGE(TO_CHAR(SQLCODE)||''||SQLERRM);

END; 

See Also: Create image presentation with Timer in Oracle Forms, http://www.foxinfotech.in/2014/02/creating-stopping-restarting-deleting-timer-oracleforms.html

Creating, Stoping, Re-Starting timer in Oracle Forms

Tune Oracle Form's PLSQL Code with the help of timer

 
Creating Timer in Oracle D2k / Forms 6i and Displaying a Clock
Reviewed by Rishion Mar 17 2013
Rating: 4

Creating Timer in Oracle D2k / Forms 6i and Displaying a Clock的更多相关文章

  1. Refresh / Updating a form screen in Oracle D2k Forms 6i

    Refresh / Updating a form screen in Oracle D2k Forms 6i ProblemYou want to show number of records pr ...

  2. Using GET_APPLICATION_PROPERTY in Oracle D2k Forms

    Using GET_APPLICATION_PROPERTY in Oracle D2k Forms DescriptionReturns information about the current ...

  3. DISPLAY_ITEM built-in in Oracle D2k Forms

    DISPLAY_ITEM built-in in Oracle D2k Forms DescriptionMaintained for backward compatibility only. For ...

  4. CHECKBOX_CHECKED built-in in Oracle D2k Forms

    CHECKBOX_CHECKED built-in in Oracle D2k Forms DescriptionA call to the CHECKBOX_CHECKED function ret ...

  5. How To Tune or Test PLSQL Code Performance in Oracle D2k Forms

    You can test or tune your program unit performance in Oracle forms with Ora_Prof package.Suppose you ...

  6. Creating Dynamic LOV in Oracle D2k Forms

    Dynamic Lov is a good idea for the form where too many Lov requirement is there with different recor ...

  7. Reading Csv Files with Text_io in Oracle D2k Forms

    Below is the example to read and import comma delimited csv file in oracle forms with D2k_Delimited_ ...

  8. Creating Object Library OLB in Oracle D2k Form

    With following steps you can create Object Library (OLB) in Oracle D2k Forms.Step - 1Create a form i ...

  9. Creating, Stopping, Re-Starting and Deleting a Timer in Oracle Forms

    I have written many posts previously on Timers in Oracle Forms like how to change images randomly wi ...

随机推荐

  1. .net web弹出对话框

    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请输入 ...

  2. 【水题】NOIP201504推销员

    NOIP201504推销员 [问题描述]   阿明是一名推销员,他奉命到螺丝街推销他们公司的产品.螺丝街是一条死胡同,出口与入口是同一个,街道的一侧是围墙,另一侧是住户.螺丝街一共有 N 家住户,第 ...

  3. 在线白板,基于socket.io的多人在线协作工具

    首发:个人博客,更新&纠错&回复 是昨天这篇博文留的尾巴,socket.io库的使用练习,成品地址在这里. 代码已经上传到github,传送门.可以开俩浏览器看效果. 现实意义是俩人在 ...

  4. maven相关

    1. 创建/导入maven项目时 eclipse默认jdk版本配置:http://blog.csdn.net/lzj0470/article/details/42292021 2. eclipse 使 ...

  5. THE HANDLER_READ_* STATUS VARIABLES

    Because I do a lot of Performance Tuning gigs I get often in contact with these status variables. In ...

  6. jquery选择器中两个class是什么意思?

    jquery选择器中两个class是什么意思? $(".class1 .class2") 选择class1元素下class2的元素(中间有空格)$(".class1.cl ...

  7. 使用PHP flush 函数的时候我们需要注意些什么呢?

    WebServer(可以认为特指apache)的缓冲区.在apache module的sapi下, flush会通过调用sapi_module的flush成员函数指针,间接的调用apache的api: ...

  8. Python升级Yum不能使用解决

    1.系统版本 [root@vm10-254-206-95 ~]# cat /etc/issue CentOS release 6.4 (Final) Kernel \r on an \m 2.系统默认 ...

  9. SpringMVC 接收复杂对象

    要发送的数据为:String topicId,String topicName,String summarize,List<ModuleParam> parentList 前端页面ajax ...

  10. 【转】MYSQL入门学习之九:索引的简单操作

    转载地址:http://www.2cto.com/database/201212/176772.html 一.创建索引  www.2cto.com           MYSQL常用的索引类型主要有以 ...