Fixed Record Format 固定長度 INFILE datafile_name "fix n" 固定11個字節 [oracle@pcqtestxi01 ~]$ cat example.ctl example.dat ----example.ctl ---- load data infile 'example.dat' "fix 11" into table example fields terminated by ',' optionally enclosed by '"' (col01,col02) ----example.dat ---- 001, cd, 0002,fghi, 00003,lmn, 1, "pqrs", 0005,uxwx, [oracle@pcqtestxi01 ~]$ sqlldr monitor/password control=example.ctl SQL*Loader: Release 11.2.0.4.0 - Production on Tue Jun 12 11:45:16 2018 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Commit point reached - logical record count 5 查詢加載成功的數據 SQL> select * from dbmonitor.example; COL01 COL02 ----- -------------------------------------------------- 001 cd 0002 fghi 00003 lmn 1 pqrs 0005 uxwx Variable Record Format 變量記錄格式 INFILE datafile_name "var n" [oracle@pcqtestxi01 ~]$ cat example01.ctl example01.dat ----example01.ctl------ load data infile 'example01.dat' "var 3" into table example fields terminated by ',' optionally enclosed by '"' (col01 char(5), col02 char(7)) ----example01.dat------ 009hello,cd,010world,im, 012my,name is, [oracle@pcqtestxi01 ~]$ sqlldr monitor/password control=example01.ctl SQL*Loader: Release 11.2.0.4.0 - Production on Tue Jun 12 11:41:03 2018 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Commit point reached - logical record count 3 [oracle@pcqtestxi01 ~]$ dba SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 12 11:41:06 2018 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select * from dbmonitor.example; COL01 COL02 ----- -------------------------------------------------- hello cd world im my name is Stream Record Format 流記錄格式 INFILE datafile_name ["str terminator_string"] terminator_string被指定爲'char_string'或X'hex_string',其中: 'char_string'是用單引號或雙引號括起來的字符串 X'hex_string'是一個十六進制格式的字節串 當terminator_string包含特殊(不可打印)字符時,應該將其指定X'hex_string。可是經過使用反斜槓,能夠將一些不可打印的字符指定爲(‘char_string’) \ n表示換行 \ t表示一個水平標籤 \ f表示換頁 \ v表示一個垂直選項卡 \ r表示回車
Result
|
Exit Code
|
All rows loaded successfully
|
EX_SUCC
|
All or some rows rejected
|
EX_WARN
|
All or some rows discarded
|
EX_WARN
|
Discontinued load
|
EX_WARN
|
Command-line or syntax errors
|
EX_FAIL
|
Oracle errors nonrecoverable for SQL*Loader
|
EX_FAIL
|
Operating system errors (such as file open/close and malloc)
|
EX_FAIL
|
Table 9-2 Datatype Conversions for Datetime and Interval Datatypes
|
|
SQL*Loader Datatype
|
Oracle Database Datatype (Conversion Support)
|
N
|
N (Yes), C (Yes), D (No), T (No), TS (No), YM (No), DS (No)
|
C
|
N (Yes), C (Yes), D (Yes), T (Yes), TS (Yes), YM (Yes), DS (Yes)
|
D
|
N (No), C (Yes), D (Yes), T (No), TS (Yes), YM (No), DS (No)
|
T
|
N (No), C (Yes), D (No), T (Yes), TS (Yes), YM (No), DS (No)
|
TS
|
N (No), C (Yes), D (Yes), T (Yes), TS (Yes), YM (No), DS (No)
|
YM
|
N (No), C (Yes), D (No), T (No), TS (No), YM (Yes), DS (No)
|
DS
|
N (No), C (Yes), D (No), T (No), TS (No), YM (No), DS (Yes)
|