вы можете получить миллисекунды следующим образом:
SYS@PRJ_SCOTTY1-VM> select to_char(SYSTIMESTAMP, 'hh24:mi:ss:ff3') from dual;
TO_CHAR(SYSTIMESTAMP,'HH24:MI:SS:FF3')
------------------------------------------------------
16:06:10:944
SYS@PRJ_SCOTTY1-VM> select to_char(SYSTIMESTAMP, 'hh24:mi:ss:ff3') from dual;
TO_CHAR(SYSTIMESTAMP,'HH24:MI:SS:FF3')
------------------------------------------------------
16:06:12:241
SYS@PRJ_SCOTTY1-VM>
, если вам нужно числовое представление объекта INTERVAL, вы можете использовать эти функции:
/*
** **************************************************************************
*/
Function daysBetween
(ts1 timestamp with time zone,
ts2 timestamp with time zone,
numDec number default 0
)
Return Number is
i INTERVAL DAY(3) TO SECOND(3) := ts2 - ts1;
Begin
return round(
+ extract( day from i )
+ extract( hour from i )/60
+ extract( minute from i )/60/60
+ extract( second from i )/60/60/60
, numDec);
End;
/*
** **************************************************************************
*/
Function hoursBetween
(ts1 timestamp with time zone,
ts2 timestamp with time zone,
numDec number default 0
)
Return Number is
i INTERVAL DAY(3) TO SECOND(3) := ts2 - ts1;
Begin
return round(
+ extract( day from i )*24
+ extract( hour from i )
+ extract( minute from i )/60
+ extract( second from i )/60/60
, numDec);
End;
/*
** **************************************************************************
*/
Function minutesBetween
(ts1 timestamp with time zone,
ts2 timestamp with time zone,
numDec number default 0
)
Return Number is
i INTERVAL DAY(3) TO SECOND(3) := ts2 - ts1;
Begin
return round(
+ extract( day from i )*24*60
+ extract( hour from i )*60
+ extract( minute from i )
+ extract( second from i )/60
, numDec);
End;
/*
** **************************************************************************
*/
Function secondsBetween
(ts1 timestamp with time zone,
ts2 timestamp with time zone,
numDec number default 0
)
Return Number is
i INTERVAL DAY(3) TO SECOND(3) := ts2 - ts1;
Begin
return round(
+ extract( day from i )*24*60*60
+ extract( hour from i )*60*60
+ extract( minute from i )*60
+ extract( second from i )
, numDec);
End;
/*
** **************************************************************************
*/
Function msecBetween
(ts1 timestamp with time zone,
ts2 timestamp with time zone,
numDec number default 0
)
Return Number is
i INTERVAL DAY(3) TO SECOND(3) := ts2 - ts1;
Begin
return round (
+ extract( day from i )*24*60*60*1000
+ extract( hour from i )*60*60*1000
+ extract( minute from i )*60*1000
+ extract( second from i )*1000
, numDec);
End;