Skip to content Skip to sidebar Skip to footer

Oracle SQL To_date & To_timestamp ORA-01858: A Non-numeric Character Was Found Where A Numeric Was Expected & ORA-01850: Hour Must Be Between 0 And 23

I have a small bit of code: Code SELECT to_date(it.DSTAMP, 'DD/MM/YYYY') AS 'Date', to_timestamp(it.DSTAMP, 'HH24:MI:SS') AS Time FROM itable it Errors ORA-01858: a non-numeric c

Solution 1:

It seems that it.DSTAMP is a TIMESTAMP

Replace to_date and to_timestamp with to_char

SELECT to_char(it.DSTAMP, 'DD/MM/YYYY') AS "Date", to_char(it.DSTAMP, 'HH24:MI:SS') AS Time
FROM itable it

Post a Comment for "Oracle SQL To_date & To_timestamp ORA-01858: A Non-numeric Character Was Found Where A Numeric Was Expected & ORA-01850: Hour Must Be Between 0 And 23"