SQL Loader使用

方式一:固定长度
load data  infile ’example.dat’ "fix 10"  into table example fields terminated by ’,’(col1, col2)
example.dat:
0001,abcd
0002,fghi
0003,klmn

方式二:前几个数字规定了后面的长度
load data infile ’example.dat’ "var 3“ into table example
fields terminated by ’,’ optionally enclosed by ’"’
(col1 char(5),col2 char(7))
example.dat:
009hello,cd,
010world,im,
012my,name is,

方式三:用特殊字符分割各字段,遇到转义字符,参考具体文档
load data
infile ’example.dat’ "str ’|\n’“ 
into table example
fields terminated by ’,’ optionally enclosed by ’"’
(col1 char(5),
col2 char(7))
example.dat:
hello,world,|
james,bond,|

你可能感兴趣的:(数据库,职场,休闲,sqlloader)