您的位置:首页 > 数据库 > Oracle

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

2016-12-25 18:13 387 查看

CreatingTimerinOracleD2k/Forms6iandDisplayingaClock

ThisisabouttimerinD2k
[align=left]Anexternalclockcanbeconstructedusingtimers.Timerscorrespondtointernalclocks,whichhaveaspecifictimeperiod.Whenthespecifieddurationexpires,thetimercaneitherperformanactiononceandstoporrepeattheactionregularlyeverytimethetimerexpires.Timerdurationisalwaysinmilliseconds.TimersarecreatedusingtheCREATE_TIMERbuiltinandrequireaWHEN-TIMER-EXPIREDtriggertobewrittenattheformlevel.Thistriggerfireseverytimethetimerexpires.[/align]

UsingREPEATTimers

[align=left]Let'screateadisplayitem,CURRENT_TIME,inthehorizontaltoolbarcanvasCANVAS_TOOLBARcreatedearlier.ThisitemshowsthetimeinHH24:MI:SSformatandupdatesitselfeverysecond(thetimerduration).[/align][align=left]IntheWHEN-NEW-FORM-INSTANCEtrigger,createatimernamedCLOCK_TIMER,whichiteratesaftereveryonesecondandpopulatestheCURRENT_TIMEitemwiththesystemdateinHH24:MI:SSformat.Thecodeisasfollows:[/align][align=left][/align]
DECLARE

timer_idTIMER;

one_secondNUMBER:=1000;

BEGIN

timer_id:=FIND_TIMER('CLOCK_TIMER');

IFNOTID_NULL(timer_id)THEN

DELETE_TIMER(timer_id);

ELSE

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

ENDIF;

SELECTTO_CHAR(SYSDATE,'HH24:MI:SS')

INTO:toolbar.current_time

FROMDUAL;

EXCEPTIONWHENOTHERSTHEN

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

END;

[align=left]CreateaWHEN-TIMER-EXPIREDtriggerasfollows:[/align]
[align=left][/align]
DECLARE

timer_nameVARCHAR2(30);

BEGIN

timer_name:=GET_APPLICATION_PROPERTY(TIMER_NAME);

IFtimer_name='CLOCK_TIMER'THEN

SELECTTO_CHAR(SYSDATE,'HH24:MI:SS')

INTO:toolbar.current_time

FROMDUAL;

ENDIF;

EXCEPTIONWHENOTHERSTHEN

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

END;

SeeAlso:CreateimagepresentationwithTimerinOracleForms,http://www.foxinfotech.in/2014/02/creating-stopping-restarting-deleting-timer-oracleforms.html

Creating,Stoping,Re-StartingtimerinOracleForms

TuneOracleForm'sPLSQLCodewiththehelpoftimer




[align=left]CreatingTimerinOracleD2k/Forms6iandDisplayingaClock
ReviewedbyRishionMar172013
Rating:4[/align]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: