The GET_SECONDS stored procedure is used to calculate the number of seconds between two timestamps. This procedure is used when evaluating the duration for an operation.
Parameter | Description | |
---|---|---|
STRAT_TIMESTAMP | Type: | INPUT |
Datatype: | TIMESTAMP | |
Default Value: | None | |
Description | The starting timestamp for an operation. | |
END_TIMESTAMP | Type | INPUT |
Datatype: | TIMESTAMP | |
Default Value: | SYSTIMESTAMP | |
Description | The end timestamp for an operation. | |
ELAPSED_SECONDS | Type: | OUT |
Datatype: | NUMBER | |
Default Value: | 0 | |
Description | The calculated number of seconds to return to the caller. |
Examples
EXEC IN_DB_UTIL.GET_SECONDS(V_START_TIMESTAMP, NULL, V_TOTAL_SECS);
SET TIMING ON; SET SERVEROUTPUT ON; DECLARE V_START_TIME TIMESTAMP := SYSTIMESTAMP; V_TOTAL_SECS NUMBER; BEGIN DBMS_SESSION.SLEEP(5); IN_DB_UTIL.GET_SECONDS(V_START_TIME, NULL, V_TOTAL_SECS); DBMS_OUTPUT.PUT_LINE(CHR(10)||'Elapsed Seconds: '||V_TOTAL_SECS); END; /
Example Output
Elapsed Seconds: 4.97 PL/SQL procedure successfully completed. Elapsed: 00:00:04.97