通过Oracle 12c中IDENTITY列中的SQL * Loader加载数据

时间:2017-03-31 14:34:06

标签: sql oracle identity sql-loader

我需要使用SQL * Loader将数据加载到Oracle表中,GENERATE ALWAYS AS IDENTITY

CREATE TABLE tbl_identity
(
  col1 NUMBER(10,0) GENERATED ALWAYS AS IDENTITY(START WITH 7 INCREMENT BY 1)    NOT NULL,
  col2 VARCHAR2(20)
);

但是当我尝试在此表中加载数据时,我收到错误

ORA-32795: cannot insert into a generated always identity column

也许SQLLDR中有任何选项可以暂时跳过IDENTITY?

或者可能有任何想法如何使用SQLLDR将数据加载到GENERATED ALWAYS IDENTITY列?

SQLLDR命令

sqlldr userid=user/passw@TNS control=tbl_identity.ctl log=tbl_identity.log rows=1000 readsize=65535 bindsize=65535

CTL-文件

OPTIONS(direct=false)
LOAD DATA
INFILE 'tbl_identity.txt'
INTO TABLE tbl_identity
INSERT
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' TRAILING NULLCOLS
(col1,
 col2)

1 个答案:

答案 0 :(得分:1)

将您的DDL从GENERATED ALWAYS更改为GENERATED BY DEFAULT