这里我有以下文件
load data
infile 'emp.csv'
into table EMPLOYEES
append
fields terminated by ','
optionally ENCLOSED BY '"'
TRAILING NULLCOLS
(
TENANTID,
EMPLOYEEID,
ISEMPLOYEEACTIVE,
PASSWORD,
EMPLOYEEMANAGERID,
FIRSTNAME,
LASTNAME,
MIDDLENAME,
EMPLOYEEEMAILID,
EMPLOYEEASSISTANTID ,
CATEGORYID,
EMPLOYEENATIONALITY,
BRANCHID ,
GRADEID ,
PASSWORDRESETTOKEN,
PASSWORDRESETCREATEDATE,
ISBRANCHHEAD ,
DEFAULTCOSTCODE ,
GENDER
)
此文件中的 EMPLOYEEID
是主键,因此如何将该列设置为主键...
因为每次都需要唯一且自动生成的数字
这里是我的emp.csv文件
1006,1,0,saasas,1049,LoadData,lol,lol,bhargav121@gmail.com,1049,1125,India,2192,1128,1,1,1,1051,m
答案 0 :(得分:3)
在db中。
create sequence EMPLOYEES_SEQ
在ctlfile中
...
TENANTID,
EMPLOYEEID "EMPLOYEES_SEQ.NEXTVAL",
ISEMPLOYEEACTIVE,
...