|
Re: What is Problem with DAte Query [message #303606 is a reply to message #303604] |
Sat, 01 March 2008 01:28 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/102589.gif) |
Michel Cadot
Messages: 68663 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
ORA-01843: not a valid month
Mixing strings and numbers is a bad idea, you don't know how conversions are made.
If you remove the final TO_DATE you see the problem:
SQL> select TO_CHAR(SYSDATE, 'DDMM')||TO_NUMBER(TO_CHAR(SYSDATE, 'YYYY'))-5 from dual;
1032003
In addition, if you want to substract 5 years, have a look at ADD_MONTHS function.
Regards
Michel
[Updated on: Sat, 01 March 2008 01:32] Report message to a moderator
|
|
|