ORA-01821: date format not recognized

ORA-01821: date format not recognized

Oracle PL/SQL error message: ORA-01821: date format not recognized.

Cause:

A date specification contained an invalid format code.

Solution:

Check that only valid date format codes are specified.




Example:

SELECT TO_CHAR(sysdate,'YYYY/MM/DD H:MI:SS') FROM dual;

Output:

ORA-01821: date format not recognized

Correct:

SELECT TO_CHAR(sysdate,'YYYY/MM/DD HH24:MI:SS') FROM dual;

Output:

2015/12/26 09:56:04