Re: Simple Oracle Questions!
From: Tommy Wareing <p0070621_at_oxford-brookes.ac.uk>
Date: Mon, 6 Jun 1994 08:30:58 GMT
Message-ID: <Cqyvnn.JtL_at_uk.ac.brookes>
Date: Mon, 6 Jun 1994 08:30:58 GMT
Message-ID: <Cqyvnn.JtL_at_uk.ac.brookes>
Jay Patel (pateljb_at_ucunix.san.uc.edu) wrote:
> Folks,
> I'm learning Oralce (6.0), so please, excuse my simple questions.
> 1) How'd I subtract Time??
> I tried :
> to_char(f1, 'HH24:MM:SS') - to_char(f2, 'HH24:MM:SS')
> but, it doesn't work.
Hey ho.
If f1 and f2 are date fields, then f1-f2 is the number of days between
them. So if they're 6 hours apart, then f1-f2 is 0.25.
What you want is to_char(f1-f2, 'HH24:MM:SS') except that the date
package will probably complain about Julian dates being ou of range.
It's mean like that.
So:
to_char(trunc(SYSDATE)+f1-f2, 'HH24:MM:SS')
should do the trick. AS LONG AS f1 and f2 are within 24 hours of each other.
(Yes I know it's horrible, but there you go.)
-- _________________________ ______________________________________ / Tommy Wareing \ / And I dream about movies \ | p0070621_at_brookes.ac.uk X They won't make of me when I'm dead | \ 0865-483389 / \ - Jon Bon Jovi, Keep the Faith / ~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Received on Mon Jun 06 1994 - 10:30:58 CEST
