Toad World® Forums

ORA-01849: hour must be between 1 and 12 Error

Hopefully someone can help with this error I'm getting. The code line is below and the error is "ORA-01849: hour must be between 1 and 12"

REQUEST_DATETIME is a Char field and for an example contains: 08-01-2019 01:30:09am

Code Line:

WHERE TRUNC(TO_DATE(REQUEST_DATETIME,'MM/DD/YYYY HH:MI:SSAM')) = TRUNC(SYSDATE-1)

Thanks so much for your help
Mike

Hi Mike,

My kneejerk is that your data has its date elements delimited by dashes, but your date mask in the TO_DATE is delimited by slashes.

Give that a shot and let us know...

Rich