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 -> subtracting date / time in SQL

subtracting date / time in SQL

From: Syltrem <syltrem_at_videotron.ca.spammenot>
Date: Mon, 11 Jun 2001 14:59:22 -0400
Message-ID: <Wq8V6.10622$Cl1.668657@wagner.videotron.net>

I am trying to calculate the elapsed time for a connected session Example:
select sysdate - logon_time from v$session where sid=35;

SYSDATE-LOGON_TIME


        ,278344907

Which is approximately 6 hours (a quarter of a day).

Now I want to display this in time format, I tried the following select to_char(sysdate - logon_time, 'HH:MI:SS') from v$session where sid=35

                                     *

ERROR at line 1:
ORA-01481: invalid number format model

and also this
select to_char(to_date(sysdate - logon_time), 'HH:MI:SS') from v$session where sid=35;

What am I doing wrong?

Thanks for helping me!
--

Syltrem
http://pages.infinit.net/syltrem (OpenVMS related web site) To reply to myself directly, remove .spammenot from my address Received on Mon Jun 11 2001 - 13:59:22 CDT

Original text of this message

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