Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with conversion from date to char

729894Nov 19 2009 — edited Nov 19 2009
Hi all!
I wonder why this doesn't work:

SELECT TO_DATE('&&date1', 'DD-Mon-RR'), TO_CHAR('&date1', 'DD-Mon')
FROM DUAL;
UNDEFINE date1;

Furthermore I don't understand why I get "ORA-01722: invalid number". As far as I know this happens when converting TO_NUMBER, which is not the case.

The only way I got this to work is:
SELECT TO_DATE('&&date1', 'DD-Mon-RR'), TO_CHAR(TO_DATE('&date1', 'DD-Mon-RR'), 'DD-Mon')
FROM DUAL;
UNDEFINE date1;

But this way it's more cumbersome.
This post has been answered by Toon Koppelaars on Nov 19 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 17 2009
Added on Nov 19 2009
11 comments
1,349 views