Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

oracle date issue

Status
Not open for further replies.

vedicman

Programmer
Sep 5, 2003
128
US
I'm just starting to work with oracle dates. What is the correct way to pull svc.SV_ADJ_DATE (s) that are greater than 1/1/2005?


Select Distinct svc.SV_ADJ_DATE
From MI50_RMH.SERVICES svc
Where svc.SV_ADJ_DATE >= 01/01/2005


Thanks...Franco
 
Franco,

Syntactically, you would say this:
Code:
Select Distinct svc.SV_ADJ_DATE
From MI50_RMH.SERVICES  svc
Where svc.SV_ADJ_DATE  >= to_date('01/01/2005','mm/dd/yyyy');
Oracle DATE expressions include not only the DATE, but also the TIME (down to the second). So, leaving your code the way it is will probably give you a separate row for each record. Instead, I believe that you probably want just the date portion of SV_ADJ_DATE (i.e., stripping the TIME portion).

To achieve that result, you can use this code:Select Distinct trunc(svc.SV_ADJ_DATE)
From MI50_RMH.SERVICES svc
Where svc.SV_ADJ_DATE >= to_date('01/01/2005','mm/dd/yyyy');[/code]Let us know if this helps you achieve the results you want.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top