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. [tp3.2.1]sql查询语句(一)

    基本查询方式    字符串条件查询,    索引数组条件查询    对象条件查询    SQL语句大小写是一样的,但是,执行的时候有一个小写到大写的转换,所以最好写大写 $condition=new ...

  2. android提示框

    // 对话框 AlertDialog.Builder builder = new Builder(MainActivity.this); builder.setMessage("是否确认删除 ...

  3. ActiveMQ消息的可靠性机制(转)

    文章转自:http://www.linuxidc.com/Linux/2013-02/79664.htm 1.JMS消息确认机制 JMS消息只有在被确认之后,才认为已经被成功地消费了.消息的成功消费通 ...

  4. 分享总结:更好地CodeReview

            代码质量分享    2016_06_24_舒琴_代码质量.key    For 代码提交人     基本原则 Review时机: 对于普通bugfix或优化,CodeReview最迟要 ...

  5. ubunt1204安装配置vsftp

    本文将搭建一个最简单的ftp服务,即通过root用户可进行登录.上传.下载,具体步骤如下: 1.安装vsftpd服务 sudo apt-get install vsftpd 2.编辑vsftp配置文件 ...

  6. Swoole 遇上 PHP会是怎样的结果呢

    一直想写点Swoole的东西,毕竟它重新定义了php,却一直不知道怎么下手写 Swoole涉及的知识点非常多,互为表里,每次想写都发现根本理不出一个头绪 Swoole是一个php的扩展,它的核心目的就 ...

  7. HDU 1890:Robotic Sort(Splay)

    http://acm.hdu.edu.cn/showproblem.php?pid=1890 题意:有一个无序序列,经过不断地翻转,使得最后的序列是一个升序的序列,而且如果相同数字要使在原本序列靠前的 ...

  8. 使用radioGroup的时候,每个radioButton的状态选择器要使用 state_checked=""属性,不能使用selected

    使用radioGroup的时候,每个radioButton的状态选择器要使用 state_checked=""属性,不能使用selected

  9. Python repr() 或str() 函数(转)

    Python 有办法将任意值转为字符串:将它传入repr() 或str() 函数.函数str() 用于将值转化为适于人阅读的形式,而repr() 转化为供解释器读取的形式(如果没有等价的语法,则会发生 ...

  10. YTU 2991: 链表节点逆置(线性表)

    2991: 链表节点逆置(线性表) 时间限制: 1 Sec  内存限制: 128 MB 提交: 14  解决: 6 题目描述 设计一个算法,将一个带头节点的数据域依次为a1,a2,-,an(n> ...