无法通过sqlldr(Sql loader)上传数据

时间:2015-07-29 06:16:29

标签: oracle sql-loader

我试图通过sql loader上传数据,但是我无法在oracle数据库中上传数据,而且我发现错误。

data test.csv

1,a,b,c,d,20150728
2,a1,b1,c1,d1,20150727
3,a2,b2,c2,d2,20150726
4,a3,b3,c3,d3,20150725
5,a4,b4,c4,d4,20150724

第一种方法

load data
into table table_abc
fields terminated by "," optionally enclosed by '"'
(t1,t2,t3,t4,t5,t6 date 'YYYYMMDD')

错误

Record 1: Rejected - Error on table T_LLY_08135_20150302_001, column t6.
ORA-01858: a non-numeric character was found where a numeric was expected

第二种方法

load data
into table table_abc
fields terminated by "," optionally enclosed by '"'
(t1,t2,t3,t4,t5,t6 date TO_DATE(t6,"MMDDYYYY"))

错误

SQL*Loader-350: Syntax error at line 4.
Expecting "," or ")", found "TO_DATE".
t1,t2,t3,t4,t5, date TO_DATE(t6,"MMDDY

表格结构

sqlplus> desc table_abc
    TABLE varchar2
     Name    Null?    Type                        
     --------- -------- ----------------------------
     t1      NOT NULL NUMBER(38)                  
     t2               varchar2(38)                  
     t3               varchar2(38)                  
     t4               varchar2(38)                  
     t5               VARCHAR2(400)
     t6               date                            

1 个答案:

答案 0 :(得分:1)

尝试你的第一个例子,但使用双引号

load data
into table table_abc
fields terminated by "," optionally enclosed by '"'
(t1,t2,t3,t4,t5,t6 date "YYYYMMDD")