SQLLoaders使用说明

cmd

sqlplus scott/tiger
create table aa(a int,b varchar(20));
select * from aa
exit

sqlldr scott/tiger control=c:\a.ctl data=c:\a.txt  -----命令

load data                
infile 'c:\a.txt'
append
into table aa
fields terminated by ","
optionally enclosed by '"'
(a,b)

load data
infile 'c:\a.txt'
append
into table aa
(a position(1:1),b position(3:6))

1,aaaa
2,bbbb

-----------导入到多个表中
LOAD DATA
INFILE *
REPLACE
INTO TABLE emp
WHEN empno != ' '
( empno POSITION(1:4) INTEGER EXTERNAL,
ename POSITION(6:15) CHAR,
deptno POSITION(17:18) CHAR,
mgr POSITION(20:23) INTEGER EXTERNAL
)
INTO TABLE proj
WHEN projno != ' '
( projno POSITION(25:27) INTEGER EXTERNAL,
empno POSITION(1:4) INTEGER EXTERNAL
)
-----------导入选定的记录
如下例: (01) 代表第一个字符, (30:37) 代表30到37之间的字符:
LOAD DATA
INFILE 'mydata.dat' BADFILE 'mydata.bad'
DISCARDFILE 'mydata.dis'
APPEND
INTO TABLE my_selective_table
WHEN (01) <>; 'H' and (01) <>; 'T'
and (30:37) = '19991217'
(
region CONSTANT '31',
service_key POSITION(01:11) INTEGER EXTERNAL,
call_b_no POSITION(12:29) CHAR
)
-----------
导入时跳过某些字段:
POSTION(x:y) 来分隔。FILLER 字段用来跳过、忽略导入数据文件中的字段。如:
LOAD DATA
TRUNCATE INTO TABLE T1
FIELDS TERMINATED BY ','
( field1,
field2 FILLER,
field3
)
导入多行记录:CONCATENATE      or      CONTINUEIF
 

 

你可能感兴趣的:(C++,c,C#)