Home » SQL & PL/SQL » SQL & PL/SQL » HELP!!! Oracle DATE Functions...Query data 5 months prior
HELP!!! Oracle DATE Functions...Query data 5 months prior [message #229684] Mon, 09 April 2007 13:11 Go to next message
hdogg
Messages: 93
Registered: March 2007
Member
Hi I am using an Oracle PHP combo...

I want to do the following:

Query from a table all records from the current date and back 6 months

TABLE: FORECAST_ACTUALS
IE Latest DATE = 31-MAR-07 * Note, latest date changing every month.
IE want data 30-SEP-06 till 31-Mar-07.



-Hyrum
Re: HELP!!! Oracle DATE Functions...Query data 5 months prior [message #229687 is a reply to message #229684] Mon, 09 April 2007 13:16 Go to previous messageGo to next message
Michel Cadot
Messages: 64102
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
ADD_MONTHS
Regards
Michel
Re: HELP!!! Oracle DATE Functions...Query data 5 months prior [message #229689 is a reply to message #229684] Mon, 09 April 2007 13:18 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
use BETWEEN & construct the two (beg/end) dates based upon SYSDATE
Re: HELP!!! Oracle DATE Functions...Query data 5 months prior [message #229705 is a reply to message #229684] Mon, 09 April 2007 15:23 Go to previous message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
And make sure you actually use DATES and not character strings.

to_date('31-mar-2007','dd-mon-yyyy')

NOT

'31-mar-07'
Previous Topic: Aleatory Numeric or Value error
Next Topic: ref cursor, collection inside a ref cursor????
Goto Forum:
  


Current Time: Fri Dec 02 19:03:14 CST 2016

Total time taken to generate the page: 0.19109 seconds