|
--------------------------------------------------------------------------------
-- FUNCTION DEC_SECONDS
--
-- Purpose used to calculate the number of seconds between two timestamps
-- Limitations This does not support timestamps that cross months
-- Version 1.0
-- Oracle Version 10.2
-- Date 19 Oct 2007
--
-- Disclaimer This source code is provided free by Texas Memory Systems. This
-- software is provide without support, and the user assumes all
-- risk in it's use. You may use, or modify this in any way that
-- you choose
--------------------------------------------------------------------------------
create or replace function dec_seconds( begin_time in timestamp,
end_time in timestamp)
return number
is
var_day number;
var_hou number;
var_min number;
var_sec number;
begin
select extract(day from end_time - begin_time)
into var_day
from dual;
select extract(hour from end_time - begin_time)
into var_hou
from dual;
select extract(minute from end_time - begin_time)
into var_min
from dual;
select extract(second from end_time - begin_time)
into var_sec
from dual;
return ((var_day * 86400 ) + (var_hou * 3600) + (var_min * 60) + var_sec);
end dec_seconds;
/
|