I had an app that was making queries against an OracleDB database (19c).
The app was sending timestamp parameters in ISO 8601 format and the table had a column that was an Oracle TIMESTAMP type (not an Oracle TIMESTAMP WITH TIMEZONE type) that was just known to store timestamps that represented UTC time.
I thought the following query would work but it didn't seem to recognize the literals that were surrounded by double quotes:
SELECT * FROM measurements
WHERE measID = '333'
AND measTime > to_timestamp('2020-11-19T05:00:00Z', 'YYYY-MM-DD"T"hh:mm:ss"Z"');
-- Doesn't Work
-- ORA-01810: format code appears twice
-- 01810. 00000 - "format code appears twice"
The following did work for me:
SELECT * FROM measurements
WHERE measID = '333'
AND measTime > SYS_EXTRACT_UTC(TO_UTC_TIMESTAMP_TZ('2020-11-19T05:00:00Z'));
-- Works
Sharing because formatting ISO 8601 to TIMESTAMP types wasn't immediately clear in Oracle documentation.
I found this solution here:
https://oracle-base.com/articles/18c/to_utc_timestamp_tz-function-18c