Home » SQL & PL/SQL » SQL & PL/SQL » Date Query
icon5.gif  Date Query [message #280345] Tue, 13 November 2007 05:07 Go to next message
balaji23_d
Messages: 123
Registered: February 2007
Senior Member
Hi all,

How to check the date(Sysdate) with less than 6 months(No need to mention the 6th month date)
Re: Date Query [message #280348 is a reply to message #280345] Tue, 13 November 2007 05:13 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Don't worry, on any reasonably fast machine a check of sysdate will take less than 6 months.

At least, that's how I understood your question.
Re: Date Query [message #280351 is a reply to message #280345] Tue, 13 November 2007 05:20 Go to previous messageGo to next message
balaji23_d
Messages: 123
Registered: February 2007
Senior Member
I need to check the list of customers who have not the paid the amount with less than 6 months...Pls send the query

This is what i did
select app.app_id,app.app_contract_dt from omf_api_applications app 
where app.app_contract_dt < to_date('01/05/2007', 'dd/mm/yyyy')


Instead of '01/05/2007' what do we can using?... Because we dont know whats the 6 month date? Pls solve my problem
Re: Date Query [message #280353 is a reply to message #280351] Tue, 13 November 2007 05:28 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Is this what you are after?

select app.app_id,app.app_contract_dt from omf_api_applications app 
where app.app_contract_dt < add_months(Trunc(SYSDATE,'MM'), -6)
Re: Date Query [message #280354 is a reply to message #280351] Tue, 13 November 2007 05:28 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
pls is not here. Do you mind if I answer you instead? You are looking for ADD_MONTHS.

MHE
Re: Date Query [message #280355 is a reply to message #280351] Tue, 13 November 2007 05:30 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You can add and subtrace number from dates to give other dates:

sysdate+3 is 3 days in the future

sysdate-7 is this day last week

sysdate + (1/24) is one hour in the future

You can also use ADD_MONTHS to add calendar months onto a date:

Re: Date Query [message #280356 is a reply to message #280345] Tue, 13 November 2007 05:33 Go to previous message
balaji23_d
Messages: 123
Registered: February 2007
Senior Member
Thank you for your help
Previous Topic: want correct query
Next Topic: Surrogate key
Goto Forum:
  


Current Time: Fri Dec 09 09:35:55 CST 2016

Total time taken to generate the page: 0.06878 seconds