我在oracle数据库中有一个表:TABLESPACES,并且DATA_TIME列的类型为:date。 想要像这样打补丁的数据文件:
ALTAIR ;08-01-2019 10:33:28 ;SUB_DATA
ALTAIR ;08-01-2019 10:33:28 ;SUB_IDX
ALTAIR ;08-01-2019 10:33:28 ;SYSAUX
我的控制文件如下:
load data
infile '/home/oracle/space_monitor/logs/space_monitor.log'
INTO TABLE TABLESPACES
APPEND
Fields terminated by ";"
(
DB "TRIM(:DB)",
DATA_TIME "TRIM(:DATA_TIME)",
NAME "TRIM(:NAME)"
)
尝试加载数据时出现错误:
Record 1: Rejected - Error on table TABLESPACES, column DATA_TIME.
ORA-01843: not a valid month
当我使用TIMESTAMP文件对控件进行如下更改时:
load data
infile '/home/oracle/space_monitor/logs/space_monitor.log'
INTO TABLE TABLESPACES
APPEND
Fields terminated by ";"
(
DB "TRIM(:DB)",
DATA_TIME "to_date(:TIMESTAMP, 'DD-MM-YYYY HH24:MI:SS')",
NAME "TRIM(:NAME)"
)
我有错误:
SQL*Loader-291: Invalid bind variable :TIMESTAMP in SQL string for column DATA_TIME.
在我的数据库中oracle参数:
NLS_DATE_FORMAT like RR/MM/DD
NLS_TIMESTAMP_FORMAT like RR/MM/DD HH24:MI:SSXFF
请帮助我。
答案 0 :(得分:0)
您必须使用这些sqlloder函数(DATE fmt或TIMESTAMP fmt)中的一个。 修剪会自动完成
(
DB "TRIM(:DB)",
DATA_TIME timestamp "DD-MM-YYYY HH24:MI:SS",
NAME "TRIM(:NAME)"
)