Oracle SQLLOADER - 如何以dd-mon-rr的格式加载数据

时间:2014-10-16 09:50:50

标签: oracle sql-loader

我的文本以逗号分隔文件格式如下。

"RAZY","","","","","","","","N","Y","27-JUL-14","1","98727076437","27-JUL-14"
"TEST","","","","","","","","N","Y","27-JUN-14","1","98727076437","27-JUN-79"

我正在尝试使用SQL加载程序控制文件加载它。

OPTIONS (SKIP=0)
LOAD DATA
INFILE      '/home/test.txt'
BADFILE     '/home/test.bad'
DISCARDFILE '/home/test.dis'
APPEND
INTO TABLE "TEST" 
 fields terminated by ","
optionally enclosed by '"'
TRAILING NULLCOLS
( 
  NAME                  ,
  TITLE                 ,
  INITIAL               ,
  SURNAME               ,
  STREET        ,
  TOWN          ,
  COUNTY        ,
  POSTCODE              ,
  TELEPHONE             ,
  FLAG        ,
  Update_DATE        DATE  "TO_DATE(:Update_DATE,'DD-MON-RR')",
  Update_STATUS      ,
  VISIT_REFERENCE  ,
  LOADED_DATE           DATE  "TO_DATE(:LOADED_DATE,'DD-MON-RR')"
 )

但是返回了错误" ORA-01821:日期格式无法识别"

由于

1 个答案:

答案 0 :(得分:1)

试试这个。

  Update_DATE        DATE  "DD-MON-RR",
  LOADED_DATE        DATE  "DD-MON-RR"