如果你看到這種行爲,則表列必須是時間戳與本地時區,你在新加坡等(GMT +8),例如:
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
,如果你想保留CST部分,而不是將其轉換,然後將您的表定義爲TIMESTAMP WITH TIME ZONE。
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