基于Oracle文档,它以数字的形式在内部存储带有时区的时间戳的不同部分。我读了这篇文章http://www.orafaq.com/wiki/Timestamp 解释了时间戳内部格式的算法。所以我做了一个简单的测试来验证它。
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
orafaq 中的文章讨论了 oracle 如何存储时区偏移量,我的第一行测试证明了这一点。但是没有关于如何存储时区文字的内容。所以我很想知道它。我还想知道 oracle 在内部如何评估时间戳 '1999-10-29 21:00:00 -7:00' 和时间戳 '1999-10-29 21:00:00 US/Pacific' 是相同的。