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. Win7旗舰版中的IIS配置asp.net的运行环境

    Win7旗舰版中的IIS配置asp.net的运行环境   以前弄过好多次,都没有成功,昨天晚上不知怎么地就成功了,借用我同学的一句话,这叫“灵光一闪”,废话不多说了,这个成功是有图有视频有真相地哈! ...

  2. javascript 正则表达式(二)

    /* 正则表达式方法:test(),exec(),String对象方法:match(),search(),replace(),split() 1.test()方法: 用法:  regexp对象实例.t ...

  3. 获取元素CSS值之getComputedStyle方法熟悉

    by zhangxinxu from http://www.zhangxinxu.com本文地址:http://www.zhangxinxu.com/wordpress/?p=2378 一.碎碎念~前 ...

  4. Java程序编译和运行的过程【转】

    转自:http://www.360doc.com/content/14/0218/23/9440338_353675002.shtml Java整个编译以及运行的过程相当繁琐,本文通过一个简单的程序来 ...

  5. C# Driver LINQ Tutorial

    1.介绍 该教程涵盖了1.8版本的C#驱动中的LINQ查询.你可能已经阅读最新的C# Driver Tutorial. 2.快速开始 首先,给程序添加下面的using声明 using MongoDB. ...

  6. 【jqGrid for ASP.NET MVC Documentation】.学习笔记.1.介绍

    1 介绍 jqGrid for ASP.NET MVC 是一个服务端组件. 专为MVC    分隔 model ,view , controller 的原则,完全观察者模式 非常快的速度    仅仅很 ...

  7. AJAX 数据库实例

    AJAX 用于创建动态性更强的应用程序. AJAX ASP 实例 下面的例子将演示当用户在输入框中键入字符时,网页如何与服务器进行通信: 实例 请在下面的输入框中键入字母(A - Z): 姓名: 建议 ...

  8. LINQ TO DATATABLE/DATASET基本操作之-简单查询

    废话不说,直接贴上代码: 其中:SerchLinqData();方法查询数据并返回一个datatable表.为数据源. #region 绑定数据 public static string BindDt ...

  9. c# 之五行地支

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  10. Dive into python学习笔记

    http://woodpecker.org.cn/diveintopython/index.html 1.第一个程序odbchelper.py def buildConnectionString(pa ...