Oracle SQL*加载程序时间戳为错误
我的控制文件是Oracle SQL*加载程序时间戳为错误,oracle,sql-loader,Oracle,Sql Loader,我的控制文件是 ACCESS_TIME TERMINATED BY "" "TO_TIMESTAMP_TZ(:ACCESS_TIME,'YYYY/MM/DD HH24:MI:SS:FF TZR')" 数据文件是 2012/11/12 15:18:00:765 CST 但是,当我运行SQL*Loader提交数据时,数据库访问时间与数据文件不匹配 2012/11/13 05:18:00:765000000 做一个: 在中央标准时间插入数据。当您选择数据时,它可能会显示在您的会话(本地)时区中。
ACCESS_TIME TERMINATED BY "" "TO_TIMESTAMP_TZ(:ACCESS_TIME,'YYYY/MM/DD HH24:MI:SS:FF TZR')"
数据文件是
2012/11/12 15:18:00:765 CST
但是,当我运行SQL*Loader提交数据时,数据库访问时间与数据文件不匹配
2012/11/13 05:18:00:765000000
做一个:
在中央标准时间插入数据。当您选择数据时,它可能会显示在您的会话(本地)时区中。如果您看到这种行为,则表列必须是带有本地时区的时间戳,并且您在新加坡等地(gmt+8),例如: 如果希望保留CST部分而不转换它,则将表定义为带时区的时间戳
SQL> create table test (access_time timestamp with time zone);
Table created.
SQL> host sqlldr test/test control=/tmp/load.ctl log=/tmp/load.log
SQL*Loader: Release 11.2.0.1.0 - Production on Mon Nov 12 13:27:56 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 2
SQL> select * from test;
ACCESS_TIME
---------------------------------------------------------------------------
12-NOV-12 15.18.00.765000 CST
SQL> alter session set time_zone='+08:00';
Session altered.
SQL> create table test (access_time timestamp with local time zone);
Table created.
SQL> host sqlldr test/test control=/tmp/load.ctl log=/tmp/load.log
SQL*Loader: Release 11.2.0.1.0 - Production on Mon Nov 12 13:26:14 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 2
SQL> select * from test;
ACCESS_TIME
---------------------------------------------------------------------------
13-NOV-12 05.18.00.765000
SQL> alter session set time_zone='-06:00';
Session altered.
SQL> select * from test;
ACCESS_TIME
---------------------------------------------------------------------------
12-NOV-12 15.18.00.765000
SQL> host cat /tmp/load.ctl
load data
infile *
replace
into table test
( ACCESS_TIME terminated by "" "TO_TIMESTAMP_TZ(:ACCESS_TIME,'YYYY/MM/DD HH24:MI:SS:FF TZR')"
)
begindata
2012/11/12 15:18:00:765 CST
SQL> create table test (access_time timestamp with time zone);
Table created.
SQL> host sqlldr test/test control=/tmp/load.ctl log=/tmp/load.log
SQL*Loader: Release 11.2.0.1.0 - Production on Mon Nov 12 13:27:56 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Commit point reached - logical record count 2
SQL> select * from test;
ACCESS_TIME
---------------------------------------------------------------------------
12-NOV-12 15.18.00.765000 CST