0

I'm Trying to fetch values between two timestamps, however the conversion timestamp failing with formatting error.

SELECT
        *
    FROM
        PKV
    WHERE
        extended_timestamp BETWEEN TO_TIMESTAMP('28-OCT-22 01.10.37.153016000 PM ASIA/CALCUTTA,DD-MON-YY HH24:MI:SS') AND TO_TIMESTAMP(
        '28-OCT-22 10.10.37.153016000 PM ASIA/CALCUTTA,DD-MON-YY HH24:MI:SS')

2 Answers 2

1

You put the 2 arguments of TO_TIMESTAMP in only 1 string. Note also that your date format is NLS dependent.

TO_TIMESTAMP_TZ('28-OCT-22 01.10.37.153016000 PM ASIA/CALCUTTA','DD-MON-YY HH12:MI:SS.FF9 PM TZR', 'NLS_DATE_LANGUAGE = American') 
Sign up to request clarification or add additional context in comments.

Comments

0

Use a TIMESTAMP literal:

SELECT *
FROM   PKV
WHERE  extended_timestamp
         BETWEEN TIMESTAMP '2022-10-28 13:10:37.153016000 ASIA/CALCUTTA'
         AND     TIMESTAMP '2022-10-28 22:10:37.153016000 ASIA/CALCUTTA';

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.