注:获取数据方法:
spool oradata.txt
set echo off
set pagesize 0
set feed off
set head off
set trimspool on
spool oradata.txt
select col1 || ',' || col2 || ',' || col3
from tab1
where col2 = 'XYZ';
spool off
1:
create table test_load(id number(10),uname varchar2(20), phone varchar2(20));
2:
控制文件:/home/oracle/sqlldr/loader.ctl
load data
infile '/home/oracle/sqlldr/datafile.txt'
append into table test_load
fields terminated by "," optionally enclosed by '"' --fields terminated by ","表示使用逗号分隔,OPTIONALLY ENCLOSED 表示数据应由特殊字符括起来
( id, uname, phone )
3:
数据文件:/home/oracle/sqlldr/datafile.txt
001,"david",0551-1234567
002,"dave",0551-7654311
4:执行导入
sqlloader命令:
sqlldr scott/tiger control=/home/oracle/sqlldr/loader.ctl log=/home/oracle/sqlldr/a.log
阅读(1763) | 评论(0) | 转发(0) |