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!

Date to timestamp with timezone conversion issue

Mukul GuptaMar 23 2024 — edited Mar 23 2024

I am facing a very strange issue in Oracle 19c database while converting date to timestamp with timezone. In the below first query works , the second does not , not sure why ??

Any pointers will be greately appreciated :

First query:

SELECT
CAST(TO_DATE('08-MAR-2024 02:30:02 AM','DD-MON-YYYY HH:MI:SS AM') AS TIMESTAMP WITH TIME ZONE)
FROM dual;

this one works.

Second query

SELECT
CAST(TO_DATE('10-MAR-2024 02:30:02 AM','DD-MON-YYYY HH:MI:SS AM') AS TIMESTAMP WITH TIME ZONE)
FROM
dual;

this one fails with error :

ORA-01878: specified field not found in datetime or interval
01878. 00000 - "specified field not found in datetime or interval"
*Cause: The specified field was not found in the datetime or interval.
*Action: Make sure that the specified field is in the datetime or interval.

This post has been answered by mathguy on Mar 23 2024
Jump to Answer
Comments
Post Details
Added on Mar 23 2024
8 comments
2,125 views