Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Compute difference between timestamps

Re: Compute difference between timestamps

From: <c8s3dw_at_verizon.net>
Date: 4 Jun 2006 09:55:12 -0700
Message-ID: <1149440112.459422.156100@i39g2000cwa.googlegroups.com>


Michel Cadot wrote:
> <c8s3dw_at_verizon.net> a écrit dans le message de news: 1149377499.120834.262480_at_j55g2000cwa.googlegroups.com...

>
> SQL> select t2-t1 d1, to_char(extract(second from t2-t1),'990.000') d2 from t;
> D1 D2
> ------------------------------ --------
> +000000000 00:00:26.719000 26.719
>
> 1 row selected.
>
> Regards
> Michel Cadot

That only works if the interval is less than 60 seconds.

SQL> update t set t2 = systimestamp;

1 row updated.

SQL> commit;

Commit complete.

SQL> select t1, t2, t2-t1 d1, to_char( extract ( second from t2 - t1 ), '990.000' ) d2 from t;

T1                            T2                            D1
                 D2
----------------------------  ----------------------------
--------------------------   ------

03-JUN-06 07.23.52.846000 PM 04-JUN-06 12.37.44.701000 PM +000000000 17:13:51.855000 51.855 Received on Sun Jun 04 2006 - 11:55:12 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US