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!

TO_DATE with TO_CHAR

Orcl ApexSep 7 2016 — edited Sep 7 2016

Hi All,

How to get a date formatted Month and Year in date format only i.e.

SELECT TO_CHAR(SYSDATE, MON-YYYY) FROM DUAL;

Above gives me SEP-2016.

Now I applied TO_DATE on it.

SELECT TO_DATE(TO_CHAR(SYSDATE, MON-YYYY), 'MON-YYYY') FROM DUAL;

But it gives me 01-Sep-2016 which I don't want, I want it as SEP-2016 because I have to update a table having date column for a whole month.

Please advise.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 5 2016
Added on Sep 7 2016
7 comments
13,285 views