SQL Language (MOSC)

MOSC Banner

Getting different results from FROM_TZ(TO_TIMESTAMP(...), DBTIMEZONE) query

edited Feb 28, 2024 4:15PM in SQL Language (MOSC) 4 commentsAnswered ✓

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

PL/SQL Release 12.1.0.2.0 - Production

"CORE 12.1.0.2.0 Production"

TNS for Linux: Version 12.1.0.2.0 - Production

NLSRTL Version 12.1.0.2.0 - Production

The following query gives me 3 different results depending where I run the query from:

SELECT FROM_TZ(TO_TIMESTAMP(TO_CHAR(SYSDATE,'YYYY-MM-DD HH24:MI:SS')

        ,'YYYY-MM-DD HH24:MI:SS')

    ,DBTIMEZONE) as StartDate 

FROM dual;

Result 1: 08-DEC-05 12.00.00.000000000 AM -08:00 (SQL*Developer)

Result 2: 08-DEC-05 12.00.00.000000000 AM -06:00 (LOCALHOST testing)**

Result 3: 08-DEC-05 12.00.00.000000000 AM -00:00 (Development testing)

I believe Result 2 is the correct result. I need to know how to ensure whatever machine may be issuing the query, the result will be the same.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center