Home » RDBMS Server » Server Administration » calculate months
calculate months [message #372183] Wed, 17 January 2001 18:45 Go to next message
Michelle Sudhakar
Messages: 2
Registered: January 2001
Junior Member
Hi!
Am currently trying to calculate
1) no of days since dt of hire
2) no of months since date of hire
the result for column Now n NoDt are returned in -ve nos, except for those rows wherein date of hire is in '00'.
Foll is the format

select ename, hiredate, (sysdate - hiredate)"NOW",
round
(months_between (sysdate, hiredate))"NoMths"
from emp;
Thanks for your help in my previous ? it did work.
Michelle
Re: calculate months [message #372190 is a reply to message #372183] Thu, 18 January 2001 09:57 Go to previous message
Suresh Vemulapalli
Messages: 624
Registered: August 2000
Senior Member
Hi,
your syntax is seems to be correct..Please check data.. I think hiredate is greater than sysdate

run following query :

select to_char(hiredate,'mm/dd/yyyy') from emp;

if it shows hiredate is greater than sysdate, make changes to data..

Suresh
Previous Topic: Re: help with tables...
Next Topic: How can I dop Index
Goto Forum:
  


Current Time: Sat May 18 01:00:38 CDT 2024