timestamp with time zone类型
oracle定义的语法:
timestamp [(fractional_seconds_precision)] with time zone
该类型在timestamp类型的基础上增加了时区的信息. 注意时区时差(tzh)的范围是"-12 ~ 13", fractional_seconds_precision的使用与timestamp类型是一致的. 在数据库中保存占13字节.
eg:
sql> create table ff(a timestamp(8) with time zone);
table created.
sql> desc ff;
name null? type
----------------------------------------- -------- ----------------------------
a timestamp(8) with time zone
sql> insert into ff values(to_timestamp_tz('2006-12-14 19:45:09.9003 -12:00', 'yyyy-mm-dd hh24:mi:ss.ff tzh:tzm'));
1 row created.
sql> select * from ff;
a
---------------------------------------------------------------------------
14-dec-06 07.45.09.90030000 pm -12:00
sql> insert into ff values(to_timestamp_tz('2006-12-14 19:45:09.9003 -12:00', 'yyyy-mm-dd hh24:mi:ss.ff tzh:tzm'));
1 row created.
sql> insert into ff values(to_timestamp_tz('2006-12-14 19:45:09.9003 -13:00', 'yyyy-mm-dd hh24:mi:ss.ff tzh:tzm'))
*
error at line 1:
ora-01874: time zone hour must be between -12 and 13
sql> insert into ff values(to_timestamp_tz('2006-12-14 19:45:09.9003 13:00', 'yyyy-mm-dd hh24:mi:ss.ff tzh:tzm'))
1 row created.
--------------------------
注意缩写: "tzh" time zone hour, "tzm" time zone minute
阅读(5096) | 评论(0) | 转发(0) |