looking for some solutions? You are welcome.

SOLVED: TO_ CHAR in oracle

john jo:

I am using oracle 11g and I know TO_CHAR is used to convert data into character and this query will work perfectly to get the day of the particular date.

SELECT TO_CHAR (DATE '2019-08-15', ‘Day’) FROM DUAL;

But this won’t work

SELECT TO_CHAR (DATE '15-08-2019', ‘Day’) FROM DUAL;
ERROR: ORA-01847: day of month must be between 1 and last day of month

SELECT TO_CHAR (DATE '15-aug-19', ‘Day’) FROM DUAL;
ERROR: ORA-01843: not a valid month

Why the above won’t work. I checked NLS_DATE_FORMAT it displays “DD-MON-RR”. But in first query it’s “YYYY-MM-DD”.

What am I missing here? Please explain in simple English

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots

No comments: