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. zw版【转发·台湾nvp系列Delphi例程】HALCON DivImage1

    zw版[转发·台湾nvp系列Delphi例程]HALCON DivImage1 procedure TForm1.Button1Click(Sender: TObject);var    img0, ...

  2. imread函数、namedWindow函数、imshow函数、imwrite函数

    1.imread函数 首先,我们看imread函数,可以在OpenCV官方文档中查到其原型如下: Mat imread(const string& filename, int flags=1 ...

  3. HTML data属性简介以及低版本浏览器兼容算法

    实例 使用 data-* 属性来嵌入自定义数据: <ul> <li data-animal-type="bird">Owl</li> <l ...

  4. scala一些高级类型

    package com.ming.test import scala.collection.mutable.ArrayBuffer import scala.io.Source import java ...

  5. 电影TS、TC、SCR、R5、BD、HD等版本是什么意思

    在很多电影下载网站的影片标题中我们都能看到,比如<刺杀希特勒BD版>.<游龙戏凤TS版>等,这些英文缩写都是什么意思呢?都代表什么画质?以下就是各个版本的具体含义: 1.CAM ...

  6. 理解Linux中断 (3)【转】

    转自:http://blog.csdn.net/tommy_wxie/article/details/7425712 版权声明:本文为博主原创文章,未经博主允许不得转载. .下半部 在中断处理过程中, ...

  7. linux下访问中文目录文件

    文件路径包含中文时,可输入部分文件名,然后按Tab键. 当路径包含中文括号时,用斜杠,如: \(….\) . 也可用 ls -li ,先查看inum(inode编号),然后再根据编号进行访问,用查找命 ...

  8. [ios][swift]swift GPS传感器的调用

    在Info.plist文件中添加如下配置:(1)NSLocationAlwaysUsageDescription(2)NSLocationWhenInUseUsageDescription swift ...

  9. SQL中join的用法

    关于sql语句中的连接(join)关键字,是较为常用而又不太容易理解的关键字,下面这个例子给出了一个简单的解释 --建表table1,table2:create table table1(id int ...

  10. java.lang.IllegalStateException异常简单分析和简单解决

    我们在做文件上传或者下载,或者过滤等操作时,可能要用到页面的输出流. 例如在JSP使用: response.reset(); response.setContentType(”application/ ...