首先,写一个cmd脚本 xx.cmd
sqlldr username/password control=xx.ctl errors=10000000 direct=y
再写一个bat脚本xx.bat serviceName一般就是orcl
sqlplus username/password@serviceName
若要加载sql则
call xx.cmd
sqlplus username/password@serviceName @xx.sql
写一个ctl文件xx.ctl
LOAD DATA
INFILE 'xx.txt' BADFILE 'ismpbill.bad' DISCARDFILE 'ismpbill.dsc' INTO TABLE "table1" APPEND FIELDS TERMINATED BY X'09' TRAILING NULLCOLS (column 1,column 2,column3)
指定分隔符,字段终止于X'09' (很重要),是一个制表符(TAB),如果用逗号分割就将X'09'替换为','
insert,为缺省方式,在数据装载开始时要求表为空
append,在表中追加新记录
replace,删除旧记录,替换成新装载的记录
truncate,同上
FIELDS TERMINATED BY '|'
指字段终止于'|'