Getting ORA-01839: date not valid for month specified [message #646471] |
Thu, 31 December 2015 11:12 |
|
shuklajayb4
Messages: 2 Registered: December 2015
|
Junior Member |
|
|
Hi All,
This might be nirmal issue, but not able to find out appropriate solution for this, I have requirement where user will specify number of month to pass as a user argument and based on that value SQL qyery will run to take data before those value.
For e.g. If a user wants to pull a data before 1 month and if the program executes today(Dec 31 2015), it calculates date as 31 Nov. 2015 which is invalid.
Query I am executing is as below -
SELECT TO_CHAR(sysdate - interval '1' month, 'MMDDYYYY') from dual
Where '1' is value passed by user.
Can anyone please provide me guidance how to solve this issue using SQL query?
Regards,
Jay Shukla
|
|
|
|
|
|
|
Re: Getting ORA-01839: date not valid for month specified [message #646543 is a reply to message #646477] |
Mon, 04 January 2016 03:00 |
cookiemonster
Messages: 13920 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
shuklajayb4 wrote on Thu, 31 December 2015 19:30Thanks for your response !!!
I am trying to calculate date value from dual table only.
Not according to this:
shuklajayb4 wrote on Thu, 31 December 2015 17:12I have requirement where user will specify number of month to pass as a user argument and based on that value SQL qyery will run to take data before those value.
Anyway, John and Bill have given you what you need.
|
|
|