此处不允许列 .ctl 和 .unl 文件

column not allowed here .ctl and .unl file

我有 rodina.ctl 文件和 rodina.unl 文件,当我尝试加载 rodina.ctl 时,我得到:

Record 1: Rejected - Error on table RODINA, column DATUM_UKONCENIA. ORA-00984: column not allowed here

在rodina.log

脚本:

Create table rodina (   
 id_rod Varchar2 (30) NOT NULL ,
 datum_ucasti Date NOT NULL ,   
 datum_ukoncenia Date, 
primary key (id_rod)  )  /

rodina.ctl 文件:

LOAD DATA
INFILE 'rodina.unl'
INTO TABLE rodina
FIELDS TERMINATED BY '|'
(
  ID_ROD,
  DATUM_UCASTI "MM/DD/YYYY",
  DATUM_UKONCENIA "MM/DD/YYYY"
)

rodina.unl 文件:

R001/001|05/06/2017|05/10/2017|
R002/002|05/07/2017|05/07/2017|
R003/003|05/08/2017|05/08/2017|
R004/004|05/10/2017|05/11/2017|
R005/005|05/10/2017||
R006/006|05/11/2017||
R007/007|05/12/2017|05/12/2017|
R008/008|05/12/2017|05/13/2017|
R009/009|05/13/2017|05/15/2017|
R010/010|05/14/2017|05/14/2017|
R011/011|05/15/2017|05/15/2017|
R012/012|05/16/2017|05/18/2017|
R013/013|05/17/2017||
R014/014|05/18/2017|05/20/2017|
R015/015|05/20/2017|05/20/2017|
R016/016|05/21/2017||

您的控制文件应该 call a function 将字符串转换为日期:

DATUM_UCASTI "to_date(:DATUM_UCASTI, 'MM/DD/YYYY')"

或者只添加 the DATE keyword:

DATUM_UCASTI DATE "MM/DD/YYYY"