How an oracle stores a timestamp with an internal time zone

Based on an Oracle document, it stores different parts of a timestamp with a time zone within a country in terms of numbers. I read this article http://www.orafaq.com/wiki/Timestamp , which explains the algorithm of the internal timestamp format. So I checked a simple test to test it.

 SQL> create table tz_test(id number, tz timestamp with time zone);

 Table created.

 SQL> insert into tz_test values(1, timestamp '1999-10-29 21:00:00 -7:00');

 1 row created.

 SQL> insert into tz_test values(2, timestamp '1999-10-29 21:00:00 US/Pacific');

 1 row created.

 SQL> select id, dump(tz, 10) from tz_test where tz=timestamp '1999-10-29 21:00:00 -7:00';

    ID     DUMP(TZ,10)
 --------------------------------------------------------------------------------

     1     Typ=181 Len=13: 119,199,10,30,5,1,1,0,0,0,0,13,60

     2     Typ=181 Len=13: 119,199,10,30,5,1,1,0,0,0,0,137,156

An article in orafaq talks about how an oracle stores a timezone offset, and my first line of test proved it. But there is nothing about how to store a timezone literal. Therefore, I really want to know this. I also want to know internally how the oracle evaluates the timestamp '1999-10-29 21:00:00 -7: 00' and the timestamp '1999-10-29 21:00:00 US / Pacific' are identical.

+4
2

, . $ORACLE_HOME/oracore/zoneinfo/timezone_14.dat.

SQL PST8PDT , 0x83, 0x64; , MOS 414590.1.

, , - . , , , . , , , , , .

, , 340512.1, .

, tz_offs, - , . , UTC. , .

+2

TIMESTAMP '1999-10-29 21:00:00 -7:00' TIMESTAMP'1999-10-29 21:00:00 US/Pacific' .

, :

SELECT 
    TIMESTAMP '1999-12-29 21:00:00 -7:00', 
    TIMESTAMP '1999-12-29 21:00:00 US/Pacific',
    TIMESTAMP '1999-06-29 21:00:00 -7:00', 
    TIMESTAMP '1999-06-29 21:00:00 US/Pacific'
FROM dual;

29.12.1999 21:00:00.000000000 -07:00    
29.12.1999 21:00:00.000000000 -08:00    
29.06.1999 21:00:00.000000000 -07:00    
29.06.1999 21:00:00.000000000 -07:00

US/Pacific , -7:00 !

+1

Source: https://habr.com/ru/post/1538180/


All Articles