Home » SQL & PL/SQL » SQL & PL/SQL » Finding the difference between dates
Finding the difference between dates [message #285717] Wed, 05 December 2007 06:52 Go to next message
spkj
Messages: 5
Registered: December 2007
Junior Member
Hi All,

i have a requirement to find the difference between two dates in terms of years.

Problem
-------
I have to find out the difference between two dates,
let me say sysdate and date_start and difference should be given in term of years.
i tried using datediff function but it is not giving desired results.
please help me to solve this issue.

thanks,

Re: Finding the difference between dates [message #285724 is a reply to message #285717] Wed, 05 December 2007 07:09 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Did datediff return the wrong result or did your query error out?

(datediff is a transact-sql function)
Re: Finding the difference between dates [message #285728 is a reply to message #285717] Wed, 05 December 2007 07:13 Go to previous messageGo to next message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
If this is not an Oracle question, you choose the wrong forum.

Regards
Michel
Re: Finding the difference between dates [message #285732 is a reply to message #285728] Wed, 05 December 2007 07:18 Go to previous messageGo to next message
spkj
Messages: 5
Registered: December 2007
Junior Member
hi,
thanks for the replies.
i came to know that we cannot use datediff in my query.
my requirement is to return the difference between two dates in number of years.

thanks,
Re: Finding the difference between dates [message #285739 is a reply to message #285732] Wed, 05 December 2007 07:24 Go to previous message
Michel Cadot
Messages: 68737
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
months_between

Regards
Michel
Previous Topic: Changing Order Of Columns after altering table
Next Topic: role in annonymus PL SQL block vs Database Procedure
Goto Forum:
  


Current Time: Sat Feb 15 02:17:40 CST 2025