1,文本文件temp_law_cn.txt格式如下:
CN200510053564$$20090701$$100508724$$授权$$授权
CN200510087323$$20090701$$100508725$$授权$$授权
CN200610006157$$20090701$$100508726$$授权$$授权
CN200810023067$$20090701$$$$实质审查的生效$$实质审查的生效
CN200710100548$$20090701$$$$实质审查的生效$$实质审查的生效
CN200810072982$$20090701$$$$实质审查的生效$$实质审查的生效
CN200810232568$$20090701$$$$实质审查的生效$$实质审查的生效
2,cn.ctl文件内容如下:
load data
CHARACTERSET AL32UTF8
infile 'temp_law_cn.txt'
append into table patent_lawstate_temp
fields terminated by "$$"
TRAILING NULLCOLS
(an,lpd,pn,law,lawdetail char(15000))
append.ctl的内容如下:
load data --1、控制文件标识
CHARACTERSET AL32UTF8 --指定文本编码
infile 'test.txt' --2、要输入的数据文件名为test.txt
append into table CTXSYS.test --3、向CTXSYS表空间中的表test中追加记录
fields terminated by X'09' --4、字段终止于X'09',是一个制表符
(id,username,password,sj) -----定义列对应顺序
其中append为数据装载方式,还有其他选项:
a、insert,为缺省方式,在数据装载开始时要求表为空
b、append,在表中追加新记录
c、replace,删除旧记录,替换成新装载的记录
d、truncate,同上
输入命令。
sqlldr userid=username/password control=cn.ctl
例如
sqlldr userid=\'sys/123456 as sysdba\' control='import.ctl' errors=500000 rows=10000
errors :允许错误行数,超过停止导入
rows: 每次导入行数
4,建立一个PL_SQ_YW1
-- Create sequence
create sequence PL_SQ_YW1
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 100;
5,导入正式表
insert into patent_lawstate
load data
CHARACTERSET UTF8
infile 'st_en_law.txt'
append into table patent_lawstate_temp2
fields terminated by "$$"
TRAILING NULLCOLS
(pn,lpd,law char(15000))
--------------------