(Read-only) The DSECONDS option returns the elapsed time as a DECIMAL
value. When Oracle is installed on UNIX, the DSECONDS option is the elapsed number of seconds since Oracle was started. When Oracle is installed on Windows, the DSECONDS option is the elapsed number of seconds since the computer on which Oracle is installed was rebooted. As an aid to enhancing a program's speed, DSECONDS can be used to determine how much time elapses while the program is running.
Example 5-25 Timing a Program Using DSECONDS
The following program puts the value of DSECONDS at the start of the program in a variable called t1
and then displays the difference between t1
and the value of DSECONDS after the program executes.
DEFINE prodsummary PROGRAM PROGRAM VARIABLE t1 DECIMAL t1 = dseconds LIMIT product TO ALL BLANK FOR product DO ROW WIDTH 16 name.product ACROSS month Jun96: DECIMAL 0 LSET - '$'WIDTH 18 <RSET ' (Actual)' sales rset ' (Plan)' sales.plan> DOEND BLANK ROW WIDTH 35 LSET 'The program took ' rset ' seconds.' - (dseconds - t1) END
Running this program produces the following results.
3-Person Tents $95,121 (actual) $80,138 (plan) Aluminum Canoes $157,762 (actual) $132,931 (plan) Tennis Racquets $97,174 (actual) $84,758 (plan) Warm-up Suits $79,630 (actual) $73,569 (plan) Running Shoes $153,688 (actual) $109,219 (plan) The program took .20 seconds.