SQL*Loader 用于将大量数据装入数据库。
⑴、定宽数据
创建数据文件control.txt:
aaa,bbb
ccc,ddd
eee,fff
创建控制文件control.ctl:
load data
infile 'c:/loader.txt'
append
into table tester.mm(
m1 position(1:3) char,
m2 position(5:7) char)
批量加载数据:
sqlldr tester/test control=c:/loader.ctl data=c:/loader.txt
⑵、定界符数据
创建数据文件control.txt:
abc|def,xyz
a,bbb
cc,ddd
eee-dd,fff-le
创建控制文件control.ctl:
load data
infile 'c:/loader.txt'
append
into table tester.mm(
m1 char terminated by ",",
m2 char terminated by ",")
批量加载数据:
sqlldr tester/test control=c:/loader.ctl data=c:/loader.txt