Or perhaps CAST(diff_time AS INTERVAL DAY(4) TO SECOND(0)) which would give something like DIFF_TIME--------------------------------------------------------------------------- +1528 03:14:22
-----Original message----- From: David Taft Date: 11/10/07 18:58
Looks useful for figuring out things like elapsed time. No doubt there are other ways to do the same thing and I'm sure there are many other uses for cast. I'm glad to have been made aware of this function. David ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--Elapsed days and time since object creation and last DDL change. col days heading "Elapsed|Days" col time heading "Elapsed|Time" select lpad(extract(day from objtime.diff_time),5) days, lpad(extract(hour from objtime.diff_time),2,'0')||':'|| lpad(extract(minute from objtime.diff_time),2,'0')||':'|| lpad(extract(second from objtime.diff_time),2,'0') time from(select cast(LAST_DDL_TIME as timestamp) - cast(CREATED as timestamp) diff_timefrom DBA_OBJECTS where owner='SYS' and object_type='PACKAGE BODY' and object_name='DBMS_ALERT') objtime / Elaps Elapsed Days Time ----- -------- 1528 03:14:22On 10/11/07, *Jared Still* <jkstill@xxxxxxxxx <mailto:jkstill@xxxxxxxxx>> wrote:On 10/11/07, *Rumpi Gravenstein* < rgravens@xxxxxxxxx <mailto:rgravens@xxxxxxxxx>> wrote: I've been looking at the Oracle CAST function vs. a TO_NUMBER or TO_CHAR or .... Where both the CAST and TO_ functions result in equivalent answers, is there a preferred choice?CAST() is clearly faster than TO_DATE, and more robust as well. There may be other advantages to using it.
-- //www.freelists.org/webpage/oracle-l