Anda di halaman 1dari 48

5 SQL*Loader Control File Reference

This chapter describes the SQL*Loader control file. The following topics are included:
Control File Contents
Specifying Command-Line arameters in the Control File
Specifying Filenames and !b"ect #ames
Specifying $atafiles
%dentifying $ata in the Control File with &'(%#$)T)
Specifying $atafile Format and &uffering
Specifying the &ad File
Specifying the $iscard File
*andling $ifferent Character 'ncoding Schemes
%nterrupted Loads
)ssembling Logical +ecords from hysical +ecords
Loading Logical +ecords into Tables
%nde, !ptions
&enefits of -sing .ultiple %#T! T)&L' Clauses
&ind )rrays and Con/entional ath Loads
Control File Contents
The SQL*Loader control file is a te,t file that contains data definition language 0$$L1
instructions. $$L is used to control the following aspects of a SQL*Loader session:
2here SQL*Loader will find the data to load
*ow SQL*Loader e,pects that data to be formatted
*ow SQL*Loader will be configured 0memory management3 re"ecting records3
interrupted load handling3 and so on1 as it loads the data
*ow SQL*Loader will manipulate the data being loaded
See )ppendi, ) for synta, diagrams of the SQL*Loader $$L.
To create the SQL*Loader control file3 use a te,t editor such as /i or ,emacs.create.
%n general3 the control file has three main sections3 in the following order:
Session-wide information
Table and field-list information
%nput data 0optional section1
',ample 4-5 shows a sample control file.
Example 5-1 Sample Control File
1 -- This is a sample control file
2 LOAD DATA
3 INFILE 'sample.dat'
4 BADFILE 'sample.bad'
5 DISA!DFILE 'sample.dsc'
6 A""END
7 INTO TABLE emp
8 #$EN %&'( ) '.'
9 T!AILIN* N+LLOLS
10 %hiredate S,SDATE-
deptno "OSITION%./0( INTE*E! E1TE!NAL%0(
N+LLIF deptno)BLAN2S-
3ob "OSITION%'/.4( $A! TE!5INATED B, #$ITES"AE
N+LLIF 3ob)BLAN2S 6+""E!%/3ob(6-
m7r "OSITION%08/9.( INTE*E! E1TE!NAL
TE!5INATED B, #$ITES"AE- N+LLIF m7r)BLAN2S-
ename "OSITION%94/4.( $A!
TE!5INATED B, #$ITES"AE 6+""E!%/ename(6-
empno "OSITION%4&( INTE*E! E1TE!NAL
TE!5INATED B, #$ITES"AE-
sal "OSITION%&.( $A! TE!5INATED B, #$ITES"AE
6TO:N+5BE!%/sal-';<<-<<<.<<'(6-
comm INTE*E! E1TE!NAL ENLOSED B, '%' AND '='
6/comm > .??6
(
%n this sample control file3 the numbers that appear to the left would not appear in a real
control file. They are 6eyed in this sample to the e,planatory notes in the following list:
5. This is how comments are entered in a control file. See Comments in the Control
File.
5. The LOAD DATA statement tells SQL*Loader that this is the beginning of a new
data load. See )ppendi, ) for synta, information.
5. The INFILE clause specifies the name of a datafile containing data that you want
to load. See Specifying $atafiles.
5. The BADFILE parameter specifies the name of a file into which re"ected records
are placed. See Specifying the &ad File.
5. The DISA!DFILE parameter specifies the name of a file into which discarded
records are placed. See Specifying the $iscard File.
5. The A""END parameter is one of the options you can use when loading data into a
table that is not empty. See Loading $ata into #onempty Tables.
To load data into a table that is empty3 you would use the INSE!T parameter. See
Loading $ata into 'mpty Tables.
5. The INTO TABLE clause allows you to identify tables3 fields3 and datatypes. %t
defines the relationship between records in the datafile and tables in the database.
See Specifying Table #ames.
5. The #$EN clause specifies one or more field conditions. SQL*Loader decides
whether or not to load the data based on these field conditions. See Loading
+ecords &ased on a Condition.
5. The T!AILIN* N+LLOLS clause tells SQL*Loader to treat any relati/ely
positioned columns that are not present in the record as null columns. See
*andling Short +ecords with .issing $ata.
5. The remainder of the control file contains the field list3 which pro/ides
information about column formats in the table being loaded. See Chapter 7 for
information about that section of the control file.
Comments in the Control File
Comments can appear anywhere in the command section of the file3 but they should not
appear within the data. recede any comment with two hyphens3 for e,ample:
--This is a comment
)ll te,t to the right of the double hyphen is ignored3 until the end of the line. )n e,ample
of comments in a control file is shown in Case Study 8: Loading a $elimited3 Free-
Format File.
Specifying Command-Line Parameters in the
Control File
The O"TIONS clause is useful when you typically in/o6e a control file with the same set
of options. The O"TIONS clause precedes the LOAD DATA statement.
OPTIOS Cla!se
The O"TIONS clause allows you to specify runtime parameters in the control file3 rather
than on the command line. The following parameters can be specified using the O"TIONS
clause. These parameters are described in greater detail in Chapter 9.
BINDSI@E ) n
OL+5NA!!A,!O#S ) n
DI!ET ) AT!+E B FALSEC
E!!O!S ) n
LOAD ) n
5+LTIT$!EADIN* ) AT!+E B FALSEC
"A!ALLEL ) AT!+E B FALSEC
!EADSI@E ) n
!ES+5ABLE ) AT!+E B FALSEC
!ES+5ABLE:NA5E ) 'teDt strin7'
!ES+5ABLE:TI5EO+T ) n
!O#S ) n
SILENT ) A$EADE!S B FEEDBA2 B E!!O!S B DISA!DS B "A!TITIONS B ALLC
S2I" ) n
S2I":INDE1:5AINTENANE ) AT!+E B FALSEC
S2I":+N+SABLE:INDE1ES ) AT!+E B FALSEC
ST!EA5SI@E ) n
For e,ample:
O"TIONS %BINDSI@E).?????- SILENT)%E!!O!S- FEEDBA2( (
ote"
:alues specified on the command line o/erride /alues specified in the
O"TIONS clause in the control file.
Specifying Filenames and O#$ect ames
%n general3 SQL*Loader follows the SQL standard for specifying ob"ect names 0for
e,ample3 table and column names1. The information in this section discusses the
following topics:
Filenames That Conflict with SQL and SQL*Loader +eser/ed 2ords
Specifying SQL Strings
!perating System Considerations
Filenames That Conflict %ith SQL and SQL*Loader Reser&ed
'ords
SQL and SQL*Loader reser/ed words must be specified within double ;uotation mar6s.
The only SQL*Loader reser/ed word is ONSTANT.
<ou must use double ;uotation mar6s if the ob"ect name contains special characters other
than those recogni=ed by SQL 0>3 ?3 @13 or if the name is case sensiti/e.
See (lso"
Oracle9i SQL Reference
Specifying SQL Strings
<ou must specify SQL strings within double ;uotation mar6s. The SQL string applies
SQL operators to data fields.
See (lso"
)pplying SQL !perators to Fields
Operating System Considerations
The following sections discuss situations in which your course of action may depend on
the operating system you are using.
Specifying a Complete Path
%f you encounter problems when trying to specify a complete path name3 it may be due to
an operating system-specific incompatibility caused by special characters in the
specification. %n many cases3 specifying the path name within single ;uotation mar6s
pre/ents errors.
%f not3 please see your !racle operating system-specific documentation for possible
solutions.
)ac*slash +scape Character
%n $$L synta,3 you can place a double ;uotation mar6 inside a string delimited by
double ;uotation mar6s by preceding it with the escape character3 ABA 0if the escape
character is allowed on your operating system1. The same rule applies when single
;uotation mar6s are re;uired in a string delimited by single ;uotation mar6s.
For e,ample3 homedirBdataAnormBmydata contains a double ;uotation mar6. receding
the double ;uotation mar6 with a bac6slash indicates that the double ;uotation mar6 is to
be ta6en literally:
INFILE 'homedirEdataE6normEmFdata'
<ou can also put the escape character itself into a string by entering it twice:
For e,ample:
6so'E6far6 or 'soE'6far' is parsed as so'6far
6'soEEfar'6 or 'E'soEEfarE'' is parsed as 'soEfar'
6soEEEEfar6 or 'soEEEEfar' is parsed as soEEfar
ote"
) double ;uotation mar6 in the initial position cannot be preceded by
an escape character. Therefore3 you should a/oid creating strings with
an initial ;uotation mar6.
onporta#le Strings
There are two 6inds of character strings in a SQL*Loader control file that are not
portable between operating systems: filename and file processing option strings. 2hen
you con/ert to a different operating system3 you will probably need to modify these
strings. )ll other strings in a SQL*Loader control file should be portable between
operating systems.
+scaping the )ac*slash
%f your operating system uses the bac6slash character to separate directories in a path
name3 and if the /ersion of the !racle database ser/er running on your operating system
implements the bac6slash escape character for filenames and other nonportable strings3
then you must specify double bac6slashes in your path names and use single ;uotation
mar6s.
See your !racle operating system-specific documentation for information about which
escape characters are re;uired or allowed.
+scape Character Is Sometimes ,isallo%ed
The /ersion of the !racle database ser/er running on your operating system may not
implement the escape character for nonportable strings. 2hen the escape character is
disallowed3 a bac6slash is treated as a normal character3 rather than as an escape character
0although it is still usable in all other strings1. Then path names such as the following can
be specified normally:
INFILE 'topdirEmFdirEmFfile'
$ouble bac6slashes are not needed.
&ecause the bac6slash is not recogni=ed as an escape character3 strings within single
;uotation mar6s cannot be embedded inside another string delimited by single ;uotation
mar6s. This rule also holds for double ;uotation mar6s. ) string within double ;uotation
mar6s cannot be embedded inside another string delimited by double ;uotation mar6s.
Specifying ,atafiles
To specify a datafile that contains the data to be loaded3 use the INFILE clause3 followed
by the filename and optional file processing options string. <ou can specify multiple files
by using multiple INFILE clauses.
ote"
<ou can also specify the datafile from the command line3 using the
DATA parameter described in Command-Line arameters. ) filename
specified on the command line o/errides the first INFILE clause in the
control file.
%f no filename is specified3 the filename defaults to the control filename with an e,tension
or file type of .dat.
%f the control file itself contains the data to be loaded3 specify an asteris6 0*1. This
specification is described in %dentifying $ata in the Control File with &'(%#$)T) .
ote"
The information in this section applies only to primary datafiles. %t does
not apply to L!&F%L's or S$Fs.
For information about L!&F%L'S3 see Loading L!& $ata from
L!&F%L's.
For information about S$Fs3 see Secondary $atafiles 0S$Fs1.
The synta, for the INFILE clause is as follows:
Te,t description of the illustration infile.gif
Te,t description of the illustration infileC.gif
Table 4-5 describes the parameters for the INFILE clause.
Table 5-1 Parameters for the INFILE Clause
Parameter ,escription
INFILE or INDDN
Specifies that a datafile specification follows.
#ote that INDDN has been retained for situations in which
compatibility with $&C is re;uired.
input_filename
#ame of the file containing the data.
)ny spaces or punctuation mar6s in the filename must be
enclosed in single ;uotation mar6s. See Specifying Filenames
and !b"ect #ames.
* %f your data is in the control file itself3 use an asteris6 instead of
the filename. %f you ha/e data in the control file as well as
datafiles3 you must specify the asteris6 first in order for the data
to be read.
os_file_proc_clause
This is the file-processing options string. %t specifies the datafile
format. %t also optimi=es datafile reads. The synta, used for this
string is specific to your operating system. See Specifying
$atafile Format and &uffering.
+-amples of IFIL+ Synta-
The following list shows different ways you can specify INFILE synta,:
$ata contained in the control file itself:
INFILE >

$ata contained in a file named foo with a default e,tension of .dat/


INFILE foo

$ata contained in a file named datafile.dat with a full path specified:


INFILE 'c/GtopdirGsHbdirGdatafile.dat'

ote"
Filenames that include spaces or punctuation mar6s must be enclosed
in single ;uotation mar6s. For more details on filename specification3
see Specifying Filenames and !b"ect #ames.
Specifying .!ltiple ,atafiles
To load data from multiple datafiles in one SQL*Loader run3 use an INFILE statement for
each datafile. $atafiles need not ha/e the same file processing options3 although the
layout of the records must be identical. For e,ample3 two files could be specified with
completely different file processing options strings3 and a third could consist of data in
the control file.
<ou can also specify a separate discard file and bad file for each datafile. %n such a case3
the separate bad files and discard files must be declared immediately after each datafile
name. For e,ample3 the following e,cerpt from a control file specifies four datafiles with
separate bad and discard files:
INFILE mFdat..dat BADFILE mFdat..bad DISA!DFILE mFdat..dis
INFILE mFdat0.dat
INFILE mFdat9.dat DISA!DFILE mFdat9.dis
INFILE mFdat4.dat DISA!D5A1 .? ?
For mFdat..dat- both a bad file and discard file are e,plicitly specified.
Therefore both files are created3 as needed.
For mFdat0.dat- neither a bad file nor a discard file is specified. Therefore3 only
the bad file is created3 as needed. %f created3 the bad file has the default filename
and e,tension mFdat0.bad. The discard file is not created3 e/en if rows are
discarded.
For mFdat9.dat- the default bad file is created3 if needed. ) discard file with the
specified name 0mFdat9.dis1 is created3 as needed.
For mFdat4.dat- the default bad file is created3 if needed. &ecause the
DISA!D5A1 option is used3 SQL*Loader assumes that a discard file is re;uired
and creates it with the default name mFdat4.dsc.
Identifying ,ata in the Control File %ith
)+/I,(T(
%f the data is included in the control file itself3 then the INFILE clause is followed by an
asteris6 rather than a filename. The actual data is placed in the control file after the load
configuration specifications.
Specify the BE*INDATA parameter before the first data record. The synta, is:
BE*INDATA
data
Deep the following points in mind when using the BE*INDATA parameter:
%f you omit the BE*INDATA parameter but include data in the control file3
SQL*Loader tries to interpret your data as control information and issues an error
message. %f your data is in a separate file3 do not use the BE*INDATA parameter.
$o not use spaces or other characters on the same line as the BE*INDATA
parameter3 or the line containing BE*INDATA will be interpreted as the first line of
data.
$o not put comments after BE*INDATA- or they will also be interpreted as data.
See (lso"
Specifying $atafiles for an e,planation of using INFILE
Case Study 5: Loading :ariable-Length $ata
Specifying ,atafile Format and )!ffering
2hen configuring SQL*Loader3 you can specify an operating system-dependent file
processing options string 0os_file_proc_clause1 in the control file to specify file
format and buffering.
For e,ample3 suppose that your operating system has the following option-string synta,:
Te,t description of the illustration recsi=e.gif
%n this synta,3 !ESI@E is the si=e of a fi,ed-length record3 and B+FFE!S is the number of
buffers to use for asynchronous %E!.
To declare a file named mFdata.dat as a file that contains FG-byte records and instruct
SQL*Loader to use F %E! buffers3 you would use the following control file entry:
INFILE 'mFdata.dat' 6!ESI@E 8? B+FFE!S 86
For details on the synta, of the file processing options string3 see your !racle operating
system-specific documentation.
ote"
This e,ample uses the recommended con/ention of single ;uotation
mar6s for filenames and double ;uotation mar6s for e/erything else.
Specifying the )ad File
2hen SQL*Loader e,ecutes3 it can create a file called a bad file or re"ect file in which it
places records that were re"ected because of formatting errors or because they caused
!racle errors. %f you ha/e specified that a bad file is to be created3 the following applies:
%f one or more records are re"ected3 the bad file is created and the re"ected records
are logged.
%f no records are re"ected3 then the bad file is not created. 2hen this occurs3 you
must reinitiali=e the bad file for the ne,t run.
%f the bad file is created3 it o/erwrites any e,isting file with the same nameH
ensure that you do not o/erwrite a file you wish to retain.
ote"
!n some systems3 a new /ersion of the file is created if a file with the
same name already e,ists. See your !racle operating system-specific
documentation to find out if this is the case on your system.
To specify the name of the bad file3 use the BADFILE parameter 0or BADDN for $&C
compatibility13 followed by the bad file filename. %f you do not specify a name for the bad
file3 the name defaults to the name of the datafile with an e,tension or file type of .bad.
<ou can also specify the bad file from the command line with the BAD parameter
described in Command-Line arameters.
) filename specified on the command line is associated with the first INFILE or INDDN
clause in the control file3 o/erriding any bad file that may ha/e been specified as part of
that clause.
The bad file is created in the same record and file format as the datafile so that the data
can be reloaded after ma6ing corrections. For datafiles in stream record format3 the
record terminator that is found in the datafile is also used in the bad file.
The synta, for the bad file is as follows:
Te,t description of the illustration badfile.gif
The BADFILE or BADDN parameter specifies that a filename for the bad file follows. 0-se
BADDN when $&C compatibility is re;uired.1
The bad_filename parameter specifies a /alid filename specification for your platform.
)ny spaces or punctuation mar6s in the filename must be enclosed in single ;uotation
mar6s.
+-amples of Specifying a )ad File ame
To specify a bad file with filename foo and default file e,tension or file type of .bad-
enter:
BADFILE foo
To specify a bad file with filename bad???. and file e,tension or file type of .re3- enter
either of the following lines:
BADFILE bad???..re3
BADFILE 'G!EIET:DI!Gbad???..re3'
0o% )ad Files (re 0andled %ith LO)FIL+s and S,Fs
$ata from L!&F%L's and S$Fs is not written to a bad file when there are re"ected rows.
%f there is an error loading a L!&3 the row is not re"ected. +ather3 the LOB column is left
empty 0not null with a length of =ero 0G1 bytes1. *owe/er3 when the L!&F%L' is being
used to load an 15L column and there is an error loading this L!& data3 then the 15L
column is left as null.
Criteria for Re$ected Records
) record can be re"ected for the following reasons:
5. -pon insertion3 the record causes an !racle error 0such as in/alid data for a gi/en
datatype1.
5. The record is formatted incorrectly so that SQL*Loader cannot find field
boundaries.
5. The record /iolates a constraint or tries to ma6e a uni;ue inde, non-uni;ue.
%f the data can be e/aluated according to the #$EN clause criteria 0e/en with unbalanced
delimiters13 then it is either inserted or re"ected.
#either a con/entional path nor a direct path load will write a row to any table if it is
re"ected because of reason number C in the pre/ious list.
)dditionally3 a con/entional path load will not write a row to any tables if reason number
5 or 8 in the pre/ious list is /iolated for any one table. The row is re"ected for that table
and written to the re"ect file.
The log file indicates the !racle error for each re"ected record. Case Study 9: Loading
Combined hysical +ecords demonstrates re"ected records.
Specifying the ,iscard File
$uring SQL*Loader e,ecution3 it can create a discard file for records that do not meet
any of the loading criteria. The records contained in this file are called discarded records.
$iscarded records do not satisfy any of the #$EN clauses specified in the control file.
These records differ from re"ected records. Discarded records do not necessarily have
any bad data. #o insert is attempted on a discarded record.
) discard file is created according to the following rules:
<ou ha/e specified a discard filename and one or more records fail to satisfy all of
the #$EN clauses specified in the control file. 0%f the discard file is created3 it
o/erwrites any e,isting file with the same name3 so be sure that you do not
o/erwrite any files you wish to retain.1
%f no records are discarded3 then a discard file is not created.
To create a discard file from within a control file3 specify any of the following:
DISA!DFILE filename3 DISA!DDN filename 0$&C13 DISA!DS3 or DISA!D5A1.
To create a discard file from the command line3 specify either DISA!D or DISA!D5A1.
<ou can specify the discard file directly by specifying its name3 or indirectly by
specifying the ma,imum number of discards.
The discard file is created in the same record and file format as the datafile. For datafiles
in stream record format3 the same record terminator that is found in the datafile is also
used in the discard file.
Specifying the ,iscard File in the Control File
To specify the name of the file3 use the DISA!DFILE or DISA!DDN 0for $&C-
compatibility1 parameter3 followed by the filename.
Te,t description of the illustration discard.gif
The DISA!DFILE or DISA!DDN parameter specifies that a discard filename follows.
0-se DISA!DDN when $&C compatibility is re;uired.1
The discard_filename parameter specifies a /alid filename specification for your
platform. )ny spaces or punctuation mar6s in the filename must be enclosed in single
;uotation mar6s.
The default filename is the name of the datafile3 and the default file e,tension or file type
is .dsc. ) discard filename specified on the command line o/errides one specified in the
control file. %f a discard file with that name already e,ists3 it is either o/erwritten or a new
/ersion is created3 depending on your operating system.
Specifying the ,iscard File from the Command Line
See $%SC)+$ 0filename1 for information on how to specify a discard file from the
command line.
) filename specified on the command line o/errides any discard file that you may ha/e
specified in the control file.
+-amples of Specifying a ,iscard File ame
The following list shows different ways you can specify a name for the discard file from
within the control file:
To specify a discard file with filename circHlar and default file e,tension or file
type of .dsc:
DISA!DFILE circHlar

To specify a discard file named notappl with the file e,tension or file type
of .maF:
DISA!DFILE notappl.maF

To specify a full path to the discard file for7et.me:


DISA!DFILE 'Gdiscard:dirGfor7et.me'

Criteria for ,iscarded Records


%f there is no INTO TABLE clause specified for a record3 the record is discarded. This
situation occurs when e/ery INTO TABLE clause in the SQL*Loader control file has a
#$EN clause and3 either the record fails to match any of them3 or all fields are null.
#o records are discarded if an INTO TABLE clause is specified without a #$EN clause. )n
attempt is made to insert e/ery record into such a table. Therefore3 records may be
re"ected3 but none are discarded.
Case Study I: ',tracting $ata from a Formatted +eport pro/ides an e,ample of using a
discard file.
0o% ,iscard Files (re 0andled %ith LO)FIL+s and S,Fs
$ata from L!&F%L's and S$Fs is not written to a discard file when there are discarded
rows.
Limiting the !m#er of ,iscarded Records
<ou can limit the number of records to be discarded for each datafile by specifying an
integer:
Te,t description of the illustration discardC.gif
2hen the discard limit 0specified with integer1 is reached3 processing of the datafile
terminates and continues with the ne,t datafile3 if one e,ists.
<ou can specify a different number of discards for each datafile. !r3 if you specify the
number of discards only once3 then the ma,imum number of discards specified applies to
all files.
%f you specify a ma,imum number of discards3 but no discard filename3 SQL*Loader
creates a discard file with the default filename and file e,tension or file type.
0andling ,ifferent Character +ncoding Schemes
SQL*Loader supports different character encoding schemes 0called character sets3 or
code pages1. SQL*Loader uses features of !racleJs globali=ation support technology to
handle the /arious single-byte and multibyte character encoding schemes a/ailable today.
See (lso"
Oracle9i Database Globalization Support Guide
%n general3 loading shift-sensiti/e character data can be much slower than loading simple
)SC%% or '&C$%C data. The fastest way to load shift-sensiti/e character data is to use
fi,ed-position fields without delimiters. To impro/e performance3 remember the
following points:
The field data must ha/e an e;ual number of shift-outEshift-in bytes.
The field must start and end in single-byte mode.
%t is acceptable for the first byte to be shift-out and the last byte to be shift-in.
The first and last characters cannot be multibyte.
%f blan6s are not preser/ed and multibyte-blan6-chec6ing is re;uired3 a slower
path is used. This can happen when the shift-in byte is the last byte of a field after
single-byte blan6 stripping is performed.
The following sections pro/ide a brief introduction to some of the supported character
encoding schemes.
.!lti#yte 1(sian2 Character Sets
.ultibyte character sets support )sian languages. $ata can be loaded in multibyte
format3 and database ob"ect names 0fields3 tables3 and so on1 can be specified with
multibyte characters. %n the control file3 comments and ob"ect names can also use
multibyte characters.
3nicode Character Sets
SQL*Loader supports loading data that is in a -nicode character set.
-nicode is a uni/ersal encoded character set that supports storage of information from
most languages in a single character set. -nicode pro/ides a uni;ue code /alue for e/ery
character3 regardless of the platform3 program3 or language. There are two different
encodings for -nicode3 -TF-57 and -TF-F.
ote"
%n this manual3 you will see the terms -TF-57 and -TF57 both used.
The term -TF-57 is a general reference to -TF-57 encoding for
-nicode. The term -TF57 0no hyphen1 is the specific name of the
character set and is what you should specify for the $A!ATE!SET
parameter when you want to use -TF-57 encoding. This also applies to
-TF-F and -TFF.
The -TF-57 -nicode encoding is a fi,ed-width multibyte encoding in which the
character codes G,GGGG through G,GGIF ha/e the same meaning as the single-byte )SC%%
codes G,GG through G,IF.
The -TF-F -nicode encoding is a /ariable-width multibyte encoding in which the
character codes G,GG through G,IF ha/e the same meaning as )SC%%. ) character in
-TF-F can be 5 byte3 C bytes3 or 8 bytes long.
See (lso"
Case Study 55: Loading $ata in the -nicode Character Set
Oracle9i Database Globalization Support Guide for more
information on -nicode encoding.
,ata#ase Character Sets
The !racle database ser/er uses the database character set for data stored in SQL $A!
datatypes 0$A!- JA!$A!0- LOB- and LON*13 for identifiers such as table names3 and
for SQL statements and LESQL source code. !nly single-byte character sets and
/arying-width character sets that include either )SC%% or '&C$%C characters are
supported as database character sets. .ultibyte fi,ed-width character sets 0for e,ample3
)L57-TF571 are not supported as the database character set.
)n alternati/e character set can be used in the database for data stored in SQL N$A!
datatypes 0N$A!- NJA!$A!- and NLOB1. This alternati/e character set is called the
database national character set. !nly -nicode character sets are supported as the database
national character set.
,atafile Character Sets
&y default3 the datafile is in the character set as defined by the NLS:LAN* parameter. The
datafile character sets supported with NLS:LAN* are the same as those supported as
database character sets. SQL*Loader supports all !racle-supported character sets in the
datafile 0e/en those not supported as database character sets1.
For e,ample3 SQL*Loader supports multibyte fi,ed-width character sets 0such as
)L57-TF57 and K)57'-CF%L'$1 in the datafile. SQL*Loader also supports -TF-57
encoding with little endian byte ordering. *owe/er3 the !racle database ser/er supports
only -TF-57 encoding with big endian byte ordering 0)L57-TF571 and only as a
database national character set3 not as a database character set.
The character set of the datafile can be set up by using the NLS:LAN* parameter or by
specifying a SQL*Loader $A!ATE!SET parameter.
Inp!t Character Con&ersion
The default character set for all datafiles3 if the $A!ATE!SET parameter is not specified3
is the session character set defined by the NLS:LAN* parameter. The character set used in
input datafiles can be specified with the $A!ATE!SET parameter.
SQL*Loader has the capacity to automatically con/ert data from the datafile character set
to the database character set or the database national character set3 when they differ.
2hen data character set con/ersion is re;uired3 the target character set should be a
superset of the source datafile character set. !therwise3 characters that ha/e no e;ui/alent
in the target character set are con/erted to replacement characters3 often a default
character such as a ;uestion mar6 0M1. This causes loss of data.
The si=es of the database character types $A! and JA!$A!0 can be specified in bytes
0byte-length semantics1 or in characters 0character-length semantics1. %f they are specified
in bytes3 and data character set con/ersion is re;uired3 the con/erted /alues may ta6e
more bytes than the source /alues if the target character set uses more bytes than the
source character set for any character that is con/erted. This will result in the following
error message being reported if the larger target /alue e,ceeds the si=e of the database
column:
O!A-?.4?./ inserted KalHe too lar7e for colHmn
<ou can a/oid this problem by specifying the database column si=e in characters and by
also using character si=es in the control file to describe the data. )nother way to a/oid
this problem is to ensure that the ma,imum column si=e is large enough3 in bytes3 to hold
the con/erted /alue.
See (lso"
!racleNi $atabase Concepts for more information about
character-length semantics in the database.
Character-Length Semantics
C0(R(CT+RS+T Parameter
Specifying the $A!ATE!SET parameter tells SQL*Loader the character set of the input
datafile. The default character set for all datafiles3 if the $A!ATE!SET parameter is not
specified3 is the session character set defined by the NLS:LAN* parameter. !nly character
data 0fields in the SQL*Loader datatypes $A!- JA!$A!- JA!$A!- numeric
E1TE!NAL3 and the datetime and inter/al datatypes1 is affected by the character set of the
datafile.
The $A!ATE!SET synta, is as follows:
$A!ATE!SET char:set:name
The char_set_name /ariable specifies the character set name. #ormally3 the specified
name must be the name of an !racle-supported character set.
For -TF-57 -nicode encoding3 use the name -TF57 rather than )L57-TF57.
)L57-TF573 which is the supported !racle character set name for -TF-57 encoded data3
is only for -TF-57 data that is in big endian byte order. *owe/er3 because you are
allowed to set up data using the byte order of the system where you create the datafile3
the data in the datafile can be either big endian or little endian. Therefore3 a different
character set name 0-TF571 is used. The character set name )L57-TF57 is also
supported. &ut if you specify )L57-TF57 for a datafile that has little endian byte order3
SQL*Loader issues a warning message and processes the datafile as big endian.
The $A!ATE!SET parameter can be specified for primary datafiles as well as
L!&F%L's and S$Fs. %t is possible to specify different character sets for different input
datafiles. ) $A!ATE!SET parameter specified before the INFILE parameter applies to
the entire list of primary datafiles. %f the $A!ATE!SET parameter is specified for
primary datafiles3 the specified /alue will also be used as the default for L!&F%L's and
S$Fs. This default setting can be o/erridden by specifying the $A!ATE!SET parameter
with the L!&F%L' or S$F specification.
The character set specified with the $A!ATE!SET parameter does not apply to data in
the control file 0specified with INFILE1. To load data in a character set other than the one
specified for your session by the NLS:LAN* parameter3 you must place the data in a
separate datafile.
See (lso"
&yte !rdering
Oracle9i Database Globalization Support Guide for more
information on the names of the supported character sets
Control File Character Set
Case Study 55: Loading $ata in the -nicode Character Set for
an e,ample of loading a datafile that contains little endian -TF-
57 encoded data
Control File Character Set
The SQL*Loader control file itself is assumed to be in the character set specified for your
session by the NLS:LAN* parameter. %f the control file character set is different from the
datafile character set3 6eep the following issue in mind. $elimiters and comparison clause
/alues specified in the SQL*Loader control file as character strings are con/erted from
the control file character set to the datafile character set before any comparisons are
made. To ensure that the specifications are correct3 you may prefer to specify
he,adecimal strings3 rather than character string /alues.
%f he,adecimal strings are used with a datafile in the -TF-57 -nicode encoding3 the byte
order is different on a big endian /ersus a little endian system. For e,ample3 A3A 0comma1
in -TF-57 on a big endian system is LJGGCcJ. !n a little endian system it is LJCcGGJ.
SQL*Loader re;uires that you always specify he,adecimal strings in big endian format.
%f necessary3 SQL*Loader swaps the bytes before ma6ing comparisons. This allows the
same synta, to be used in the control file on both a big endian and a little endian system.
+ecord terminators for datafiles that are in stream format in the -TF-57 -nicode
encoding default to ABnA in -TF-57 0that is3 G,GGG) on a big endian system and G,G)GG
on a little endian system1. <ou can o/erride these default settings by using the 6ST!
'char_str'6 or the 6ST! x'hex_str'6 specification on the INFILE line. For e,ample3
you could use either of the following to specify that 'ab' is to be used as the record
terminator3 instead of '\n'.
INFILE mFfile.dat 6ST! 'ab'6
INFILE mFfile.dat 6ST! D'??4.??40'6
)ny data included after the BE*INDATA statement is also assumed to be in the character
set specified for your session by the NLS:LAN* parameter.
For the SQL*Loader datatypes %$A!- JA!$A!- JA!$A!- DATE- and E1TE!NAL
numerics13 SQL*Loader supports lengths of character fields that are specified in either
bytes 0byte-length semantics1 or characters 0character-length semantics1. For e,ample3 the
specification $A!%.?( in the control file can mean 5G bytes or 5G characters. These are
e;ui/alent if the datafile uses a single-byte character set. *owe/er3 they are often
different if the datafile uses a multibyte character set.
To a/oid insertion errors caused by e,pansion of character strings during character set
con/ersion3 use character-length semantics in both the datafile and the target database
columns.
Character-Length Semantics
&yte-length semantics are the default for all datafiles e,cept those that use the -TF57
character set 0which uses character-length semantics by default1. To o/erride the default
you can specify $A! or $A!ATE!3 as shown in the following synta,:
Te,t description of the illustration char@length.gif
The LEN*T$ parameter is placed after the $A!ATE!SET parameter in the SQL*Loader
control file. The LEN*T$ parameter applies to the synta, specification for primary
datafiles as well as to L!&F%L's and secondary datafiles 0S$Fs1. %t is possible to specify
different length semantics for different input datafiles. *owe/er3 a LEN*T$ specification
before the INFILE parameters applies to the entire list of primary datafiles. The LEN*T$
specification specified for the primary datafile is used as the default for L!&F%L's and
S$Fs. <ou can o/erride that default by specifying LEN*T$ with the L!&F%L' or S$F
specification. -nli6e the $A!ATE!SET parameter3 the LEN*T$ parameter can also apply
to data contained within the control file itself 0that is3 INFILE > synta,1.
<ou can specify $A!ATE! instead of $A! for the LEN*T$ parameter.
%f character-length semantics are being used for a SQL*Loader datafile3 then the
following SQL*Loader datatypes will use character-length semantics:
$A!
JA!$A!
JA!$A!
DATE
E1TE!NAL numerics 0INTE*E!- FLOAT- DEI5AL- and @ONED1
For the JA!$A! datatype3 the length subfield is still a binary S5ALLINT length subfield3
but its /alue indicates the length of the character string in characters.
The following datatypes use byte-length semantics e/en if character-length semantics are
being used for the datafile3 because the data is binary3 or is in a special binary-encoded
form in the case of @ONED and DEI5AL/
INTE*E!
S5ALLINT
FLOAT
DO+BLE
B,TEINT
@ONED
DEI5AL
!A#
JA!!A#
JA!!A#
*!A"$I
*!A"$I E1TE!NAL
JA!*!A"$I
The start and end arguments to the "OSITION parameter are interpreted in bytes3 e/en if
character-length semantics are in use in a datafile. This is necessary to handle datafiles
that ha/e a mi, of data of different datatypes3 some of which use character-length
semantics3 and some of which use byte-length semantics. %t is also needed to handle
position with the JA!$A! datatype3 which has a S5ALLINT length field and then the
character data. The S5ALLINT length field ta6es up a certain number of bytes depending
on the system 0usually C bytes13 but its /alue indicates the length of the character string in
characters.
Character-length semantics in the datafile can be used independent of whether or not
character-length semantics are used for the database columns. Therefore3 the datafile and
the database columns can use either the same or different length semantics.
Interr!pted Loads
Loads are interrupted and discontinued for a number of reasons. ) primary reason is
space errors3 in which SQL*Loader runs out of space for data rows or inde, entries. )
load might also be discontinued because the ma,imum number of errors was e,ceeded3
an une,pected error was returned to SQL*Loader from the ser/er3 a record was too long
in the datafile3 or a ControlOC was e,ecuted.
The beha/ior of SQL*Loader when a load is discontinued /aries depending on whether it
is a con/entional path load or a direct path load3 and on the reason the load was
interrupted. )dditionally3 when an interrupted load is continued3 the use and /alue of the
S2I" parameter can /ary depending on the particular case. The following sections e,plain
the possible scenarios.
See (lso"
SD% 0records to s6ip1
,iscontin!ed Con&entional Path Loads
%n a con/entional path load3 data is committed after all data in the bind array is loaded
into all tables. %f the load is discontinued3 only the rows that were processed up to the
time of the last commit operation are loaded. There is no partial commit of data.
,iscontin!ed ,irect Path Loads
%n a direct path load3 the beha/ior of a discontinued load /aries depending on the reason
the load was discontinued.
Load ,iscontin!ed )eca!se of Space +rrors
%f there is one INTO TABLE statement in the control file and a space error occurs3 the
following scenarios can ta6e place:
%f you are loading data into an unpartitioned table3 one partition of a partitioned
table3 or one subpartition of a composite partitioned table3 then SQL*Loader
commits as many rows as were loaded before the error occurred. This is
independent of whether the !O#S parameter was specified.
%f you are loading data into multiple subpartitions 0that is3 loading into a
partitioned table3 a composite partitioned table3 or one partition of a composite
partitioned table13 the load is discontinued and no data is sa/ed unless !O#S has
been specified. %n that case3 all data that was pre/iously committed will be sa/ed.
%f there are multiple INTO TABLE statements in the control file and a space error occurs on
one of those tables3 the following scenarios can ta6e place:
%f the space error occurs when you are loading data into an unpartitioned table3
one partition of a partitioned table3 or one subpartition of a composite partitioned
table3 SQL*Loader attempts to load data already read from the datafile into other
tables. SQL*Loader then commits as many rows as were loaded before the error
occurred. This is independent of whether the !O#S parameter was specified. %n
this scenario3 a different number of rows could be loaded into each tableH to
continue the load you would need to specify a different /alue for the S2I"
parameter for e/ery table. SQL*Loader only reports the /alue for the S2I"
parameter if it is the same for all tables.
%f the space error occurs when you are loading data into multiple subpartitions
0that is3 loading into a partitioned table3 a composite partitioned table3 or one
partition of a composite partitioned table13 the load is discontinued for all tables
and no data is sa/ed unless !O#S has been specified. %n that case3 all data that was
pre/iously committed is sa/ed3 and when you continue the load the /alue you
supply for the S2I" parameter will be the same for all tables.
Load ,iscontin!ed )eca!se .a-im!m !m#er of +rrors +-ceeded
%f the ma,imum number of errors is e,ceeded3 SQL*Loader stops loading records into
any table and the wor6 done to that point is committed. This means that when you
continue the load3 the /alue you specify for the S2I" parameter may be different for
different tables. SQL*Loader only reports the /alue for the S2I" parameter if it is the
same for all tables.
Load ,iscontin!ed )eca!se of Fatal +rrors
%f a fatal error is encountered3 the load is stopped and no data is sa/ed unless !O#S was
specified at the beginning of the load. %n that case3 all data that was pre/iously committed
is sa/ed. SQL*Loader only reports the /alue for the S2I" parameter if it is the same for
all tables.
Load ,iscontin!ed )eca!se a Control4C 'as Iss!ed
%f SQL*Loader is in the middle of sa/ing data when a ControlOC is issued3 it continues to
do the sa/e and then stops the load after the sa/e completes. !therwise3 SQL*Loader
stops the load without committing any wor6 that was not committed already. This means
that the /alue of the S2I" parameter will be the same for all tables.
Stat!s of Ta#les and Inde-es (fter an Interr!pted Load
2hen a load is discontinued3 any data already loaded remains in the tables3 and the tables
are left in a /alid state. %f the con/entional path is used3 all inde,es are left in a /alid
state.
%f the direct path load method is used3 any inde,es that run out of space are left in an
unusable state. <ou must drop these inde,es before the load can continue. <ou can re-
create the inde,es either before continuing or after the load completes.
!ther inde,es are /alid if no other errors occurred. See %nde,es Left in an -nusable State
for other reasons why an inde, might be left in an unusable state.
3sing the Log File to ,etermine Load Stat!s
The SQL*Loader log file tells you the state of the tables and inde,es and the number of
logical records already read from the input datafile. -se this information to resume the
load where it left off.
Contin!ing Single-Ta#le Loads
2hen SQL*Loader must discontinue a direct path or con/entional path load before it is
finished3 some rows ha/e probably already been committed or mar6ed with sa/epoints.
To continue the discontinued load3 use the S2I" parameter to specify the number of
logical records that ha/e already been processed by the pre/ious load. )t the time the
load is discontinued3 the /alue for S2I" is written to the log file in a message similar to
the following:
SpecifF S2I").??. Lhen continHin7 the load.
This message specifying the /alue of the S2I" parameter is preceded by a message
indicating why the load was discontinued.
#ote that for multiple-table loads3 the /alue of the S2I" parameter is displayed only if it
is the same for all tables.
See (lso"
SD% 0records to s6ip1
(ssem#ling Logical Records from Physical
Records
&ecause !racleNi supports user-defined record si=es larger than 79 D& 0see +')$S%P'
0read buffer si=e113 the need to brea6 up logical records into multiple physical records is
reduced. *owe/er3 there may still be situations in which you may want to do so. )t some
point3 when you want to combine those multiple physical records bac6 into one logical
record3 you can use one of the following clauses3 depending on your data:
ONATENATE
ONTIN+EIF
3sing COC(T+(T+ to (ssem#le Logical Records
-se ONATENATE when you want SQL*Loader to always combine the same number of
physical records to form one logical record. %n the following e,ample3 integer specifies
the number of physical records to combine.
ONATENATE integer
The integer /alue specified for ONATENATE determines the number of physical record
structures that SQL*Loader allocates for each row in the column array. &ecause the
default /alue for OL+5NA!!A,!O#S is large3 if you also specify a large /alue for
ONATENATE3 then e,cessi/e memory allocation can occur. %f this happens3 you can
impro/e performance by reducing the /alue of the OL+5NA!!A,!O#S parameter to lower
the number of rows in a column array.
See (lso"
C!L-.#)++)<+!2S
Specifying the #umber of Column )rray +ows and Si=e of
Stream &uffers
3sing COTI3+IF to (ssem#le Logical Records
-se ONTIN+EIF if the number of physical records to be continued /aries. The parameter
ONTIN+EIF is followed by a condition that is e/aluated for each physical record3 as it is
read. For e,ample3 two records might be combined if a pound sign 0?1 were in byte
position FG of the first record. %f any other character were there3 the second record would
not be added to the first.
The full synta, for ONTIN+EIF adds e/en more fle,ibility:
Te,t description of the illustration cont@if.gif
Table 4-C describes the parameters for ONTIN+EIF.
Table 5-2 Parameters for CONTINEIF
Parameter ,escription
T$IS
%f the condition is true in the current record3 then the ne,t physical record is
read and concatenated to the current physical record3 continuing until the
condition is false. %f the condition is false3 then the current physical record
becomes the last physical record of the current logical record. T$IS is the
default.
NE1T
%f the condition is true in the ne,t record3 then the current physical record is
concatenated to the current logical record3 continuing until the condition is
Parameter ,escription
false.
operator
The supported operators are e;ual and not e;ual.
For the e;ual operator3 the field and comparison string must match e,actly
for the condition to be true. For the not e;ual operator3 they may differ in
any character.
LAST
This test is similar to T$IS- but the test is always against the last nonblan6
character. %f the last nonblan6 character in the current physical record meets
the test3 then the ne,t physical record is read and concatenated to the current
physical record3 continuing until the condition is false. %f the condition is
false in the current record3 then the current physical record is the last
physical record of the current logical record.
pos_spec
Specifies the starting and ending column numbers in the physical record.
Column numbers start with 5. 'ither a hyphen or a colon is acceptable
0start-end or start:end1.
%f you omit end3 the length of the continuation field is the length of the byte
string or character string. %f you use end3 and the length of the resulting
continuation field is not the same as that of the byte string or the character
string3 the shorter one is padded. Character strings are padded with blan6s3
he,adecimal strings with =eros.
str
) string of characters to be compared to the continuation field defined by
start and end3 according to the operator. The string must be enclosed in
double or single ;uotation mar6s. The comparison is made character by
character3 blan6 padding on the right if necessary.
X'hex-
str'
) string of bytes in he,adecimal format used in the same way as str.
LJ5F&G88 would represent the three bytes with /alues 5F3 &G3 and 88
0he,adecimal1.
"!ESE!JE
%ncludes Jchar:strin7J or 1'heD:strin7J in the logical record. The default
is to e,clude them.
ote"
The positions in the ONTIN+EIF clause refer to positions in each
physical record. This is the only time you refer to positions in physical
records. )ll other references are to logical records.
%f the "!ESE!JE parameter is not used3 the continuation field is remo/ed from all physical
records when the logical record is assembled. That is3 data /alues are allowed to span the
records with no e,tra characters 0continuation characters1 in the middle.
%f the "!ESE!JE parameter is used3 the continuation field is 6ept in all physical records
when the logical record is assembled.
',ample 4-C through ',ample 4-4 show the use of ONTIN+EIF T$IS and ONTIN+EIF
NE1T- with and without the "!ESE!JE parameter.
Example 5-2 CONTINEIF T!IS "ithout the P#ESE#$E Parameter
)ssume that you ha/e physical records 59 bytes long and that a period represents a space:
==aaaaaaaa....
==bbbbbbbb....
..cccccccc....
==dddddddddd..
==eeeeeeeeee..
..ffffffffff..
%n this e,ample3 the ONTIN+EIF T$IS clause does not use the "!ESE!JE parameter:
ONTIN+EIF T$IS %./0( ) '=='
Therefore3 the logical records are assembled as follows:
aaaaaaaa....bbbbbbbb....cccccccc....
dddddddddd..eeeeeeeeee..ffffffffff..
#ote that columns 5 and C 0for e,ample3 QQ in physical record 51 are remo/ed from the
physical records when the logical records are assembled.
Example 5-% CONTINEIF T!IS &ith the P#ESE#$E Parameter
)ssume that you ha/e the same physical records as in ',ample 4-C.
%n this e,ample3 the ONTIN+EIF T$IS clause uses the "!ESE!JE parameter:
ONTIN+EIF T$IS "!ESE!JE %./0( ) '=='
Therefore3 the logical records are assembled as follows:
==aaaaaaaa....==bbbbbbbb......cccccccc....
==dddddddddd..==eeeeeeeeee....ffffffffff..
#ote that columns 5 and C are not remo/ed from the physical records when the logical
records are assembled.
Example 5-' CONTINEIF NE(T "ithout the P#ESE#$E Parameter
)ssume that you ha/e physical records 59 bytes long and that a period represents a space:
..aaaaaaaa....
==bbbbbbbb....
==cccccccc....
..dddddddddd..
==eeeeeeeeee..
==ffffffffff..
%n this e,ample3 the ONTIN+EIF NE1T clause does not use the "!ESE!JE parameter:
ONTIN+EIF NE1T %./0( ) '=='
Therefore3 the logical records are assembled as follows 0the same results as for
',ample 4-C1.
aaaaaaaa....bbbbbbbb....cccccccc....
dddddddddd..eeeeeeeeee..ffffffffff..
Example 5-5 CONTINEIF NE(T &ith the P#ESE#$E Parameter
)ssume that you ha/e the same physical records as in ',ample 4-9.
%n this e,ample3 the ONTIN+EIF NE1T clause uses the "!ESE!JE parameter:
ONTIN+EIF NE1T "!ESE!JE %./0( ) '=='
Therefore3 the logical records are assembled as follows:
..aaaaaaaa....==bbbbbbbb....==cccccccc....
..dddddddddd..==eeeeeeeeee..==ffffffffff..
See (lso"
Case Study 9: Loading Combined hysical +ecords for an e,ample of
the ONTIN+EIF clause
Loading Logical Records into Ta#les
This section describes the way in which you specify:
2hich tables you want to load
2hich records you want to load into them
$efault data delimiters for those records
*ow to handle short records with missing data
Specifying Ta#le ames
The INTO TABLE clause of the LOAD DATA statement allows you to identify tables3 fields3
and datatypes. %t defines the relationship between records in the datafile and tables in the
database. The specification of fields and datatypes is described in later sections.
ITO T()L+ Cla!se
)mong its many functions3 the INTO TABLE clause allows you to specify the table into
which you load data. To load multiple tables3 you include one INTO TABLE clause for each
table you wish to load.
To begin an INTO TABLE clause3 use the 6eywords INTO TABLE- followed by the name of
the !racle table that is to recei/e the data.
The synta, is as follows:
Te,t description of the illustration intotab.gif
The table must already e,ist. The table name should be enclosed in double ;uotation
mar6s if it is the same as any SQL or SQL*Loader reser/ed 6eyword3 if it contains any
special characters3 or if it is case sensiti/e.
INTO TABLE scott.6ONSTANT6
INTO TABLE scott.6onstant6
INTO TABLE scott.6-ONSTANT6
The user must ha/e INSE!T pri/ileges for the table being loaded. %f the table is not in the
userJs schema3 then the user must either use a synonym to reference the table or include
the schema name as part of the table name 0for e,ample3 scott.emp1.
Ta#le-Specific Loading .ethod
2hen you are loading a table3 you can use the INTO TABLE clause to specify a table-
specific loading method 0INSE!T3 A""END- !E"LAE- or T!+NATE1 that applies only to
that table. That method o/errides the global table-loading method. The global table-
loading method is INSE!T- by default3 unless a different method was specified before any
INTO TABLE clauses. The following sections discuss using these options to load data into
empty and nonempty tables.
Loading ,ata into +mpty Ta#les
%f the tables you are loading into are empty3 use the INSE!T option.
IS+RT
This is SQL*LoaderJs default method. %t re;uires the table to be empty before loading.
SQL*Loader terminates with an error if the table contains rows. Case Study 5: Loading
:ariable-Length $ata pro/ides an e,ample.
Loading ,ata into onempty Ta#les
%f the tables you are loading into already contain data3 you ha/e three options:
A""END
!E"LAE
T!+NATE
Ca!tion"
2hen !E"LAE or T!+NATE is specified3 the entire table is replaced3
not "ust indi/idual rows. )fter the rows are successfully deleted3 a
commit is issued. <ou cannot reco/er the data that was in the table
before the load3 unless it was sa/ed with ',port or a comparable utility.
ote"
This section corresponds to the $&C 6eyword !ES+5EM users of $&C
should also refer to the description of !ES+5E in )ppendi, &.
(PP+,
%f data already e,ists in the table3 SQL*Loader appends the new rows to it. %f data does
not already e,ist3 the new rows are simply loaded. <ou must ha/e SELET pri/ilege to use
the A""END option. Case Study 8: Loading a $elimited3 Free-Format File pro/ides an
e,ample.
R+PL(C+
2ith !E"LAE- all rows in the table are deleted and the new data is loaded. The table
must be in your schema3 or you must ha/e DELETE pri/ilege on the table. Case Study 9:
Loading Combined hysical +ecords pro/ides an e,ample.
The row deletes cause any delete triggers defined on the table to fire. %f DELETE ASADE
has been specified for the table3 then the cascaded deletes are carried out. For more
information on cascaded deletes3 see the information about data integrity in Oracle9i
Database Concepts.
3pdating +-isting Ro%s
The !E"LAE method is a table replacement3 not a replacement of indi/idual rows.
SQL*Loader does not update e,isting records3 e/en if they ha/e null columns. To update
e,isting rows3 use the following procedure:
5. Load your data into a wor6 table.
5. -se the SQL language +"DATE statement with correlated sub;ueries.
5. $rop the wor6 table.
For more information3 see the +"DATE statement in Oracle9i SQL Reference.
TR3C(T+
The SQL T!+NATE statement ;uic6ly and efficiently deletes all rows from a table or
cluster3 to achie/e the best possible performance. For the T!+NATE statement to operate3
the tableJs referential integrity constraints must first be disabled. %f they ha/e not been
disabled3 SQL*Loader returns an error.
!nce the integrity constraints ha/e been disabled3 DELETE ASADE is no longer defined
for the table. %f the DELETE ASADE functionality is needed3 then the contents of the
table must be manually deleted before the load begins.
The table must be in your schema3 or you must ha/e the D!O" AN, TABLE pri/ilege.
See (lso"
Oracle9i Database dministrator!s Guide for more information about
the T!+NATE statement
Ta#le-Specific OPTIOS Parameter
The O"TIONS parameter can be specified for indi/idual tables in a parallel load. 0%t is only
/alid for a parallel load.1
The synta, for the O"TIONS parameter is as follows:
Te,t description of the illustration intotab8.gif
See (lso"
arameters for arallel $irect ath Loads
Loading Records )ased on a Condition
<ou can choose to load or discard a logical record by using the #$EN clause to test a
condition in the record.
The #$EN clause appears after the table name and is followed by one or more field
conditions. The synta, for field:condition is as follows:
Te,t description of the illustration fld@cond.gif
For e,ample3 the following clause indicates that any record with the /alue A;A in the fifth
column position should be loaded:
#$EN %&( ) 'N'
) #$EN clause can contain se/eral comparisons3 pro/ided each is preceded by AND.
arentheses are optional3 but should be used for clarity with multiple comparisons "oined
by AND- for e,ample:
#$EN %deptno ) '.?'( AND %3ob ) 'SALES'(
See (lso"
-sing the 2*'#3 #-LL%F3 and $'F)-LT%F Clauses for
information about how SQL*Loader e/aluates #$EN clauses3 as
opposed to N+LLIF and DEFA+LTIF clauses
Case Study 4: Loading $ata into .ultiple Tables pro/ides an
e,ample of the #$EN clause
3sing the '0+ Cla!se %ith LO)FIL+s and S,Fs
%f a record with a L!&F%L' or S$F is discarded3 SQL*Loader s6ips the corresponding
data in that L!&F%L' or S$F.
Specifying ,efa!lt ,ata ,elimiters
%f all data fields are terminated similarly in the datafile3 you can use the FIELDS clause to
indicate the default delimiters. The synta, for the fields:spec- termination:spec-
and enclosHre:spec clauses is as follows:
fields5spec
Te,t description of the illustration fields.gif
termination5spec
Te,t description of the illustration terminat.gif
ote"
Terminator strings can contain one or more characters. )lso3
TE!5INATED B, EOF applies only to loading L!&s from L!&F%L'.
enclos!re5spec
Te,t description of the illustration enclose.gif
ote"
'nclosure strings can contain one or more characters.
<ou can o/erride the delimiter for any gi/en column by specifying it after the column
name. Case Study 8: Loading a $elimited3 Free-Format File pro/ides an e,ample.
See (lso"
Specifying $elimiters for a complete description of the synta,
Loading L!& $ata from L!&F%L's
0andling Short Records %ith .issing ,ata
2hen the control file definition specifies more fields for a record than are present in the
record3 SQL*Loader must determine whether the remaining 0specified1 columns should
be considered null or whether an error should be generated.
%f the control file definition e,plicitly states that a fieldJs starting position is beyond the
end of the logical record3 then SQL*Loader always defines the field as null. %f a field is
defined with a relati/e position 0such as dname and loc in the following e,ample13 and
the record ends before the field is found3 then SQL*Loader could either treat the field as
null or generate an error. SQL*Loader uses the presence or absence of the T!AILIN*
N+LLOLS clause 0shown in the following synta, diagram1 to determine the course of
action.
Te,t description of the illustration intotab7.gif
Te,t description of the illustration intotabI.gif
TR(ILI/ 3LLCOLS Cla!se
The T!AILIN* N+LLOLS clause tells SQL*Loader to treat any relati/ely positioned
columns that are not present in the record as null columns.
For e,ample3 consider the following data:
.? AccoHntin7
)ssume that the preceding data is read with the following control file and the record ends
after dname/
INTO TABLE dept
T!AILIN* N+LLOLS
% deptno $A! TE!5INATED B, 6 6-
dname $A! TE!5INATED B, #$ITES"AE-
loc $A! TE!5INATED B, #$ITES"AE
(
%n this case3 the remaining loc field is set to null. 2ithout the T!AILIN* N+LLOLS
clause3 an error would be generated due to missing data.
See (lso"
Case Study I: ',tracting $ata from a Formatted +eport for an e,ample
of T!AILIN* N+LLOLS
Inde- Options
This section describes the following SQL*Loader options that control how inde, entries
are created:
SO!TED INDE1ES
SIN*LE!O#
SORT+, I,+6+S Cla!se
The SO!TED INDE1ES clause applies to direct path loads. %t tells SQL*Loader that the
incoming data has already been sorted on the specified inde,es3 allowing SQL*Loader to
optimi=e performance.
See (lso"
S!+T'$ %#$'L'S Clause
SI/L+RO' Option
The SIN*LE!O# option is intended for use during a direct path load with A""END on
systems with limited memory3 or when loading a small number of records into a large
table. This option inserts each inde, entry directly into the inde,3 one record at a time.
&y default3 SQL*Loader does not use SIN*LE!O# to append records to a table. %nstead3
inde, entries are put into a separate3 temporary storage area and merged with the original
inde, at the end of the load. This method achie/es better performance and produces an
optimal inde,3 but it re;uires e,tra storage space. $uring the merge3 the original inde,3
the new inde,3 and the space for new entries all simultaneously occupy storage space.
2ith the SIN*LE!O# option3 storage space is not re;uired for new inde, entries or for a
new inde,. The resulting inde, may not be as optimal as a freshly sorted one3 but it ta6es
less space to produce. %t also ta6es more time because additional -#$! information is
generated for each inde, insert. This option is suggested for use when either of the
following situations e,ists:
)/ailable storage is limited.
The number of records to be loaded is small compared to the si=e of the table 0a
ratio of 5:CG or less is recommended1.
)enefits of 3sing .!ltiple ITO T()L+ Cla!ses
.ultiple INTO TABLE clauses allow you to:
Load data into different tables
',tract multiple logical records from a single input record
$istinguish different input record formats
$istinguish different input row ob"ect subtypes
%n the first case3 it is common for the INTO TABLE clauses to refer to the same table. This
section illustrates the different ways to use multiple INTO TABLE clauses and shows you
how to use the "OSITION parameter.
ote"
) 6ey point when using multiple INTO TABLE clauses is that field
scanning continues from "here it left off when a new INTO TABLE
clause is processed. The remainder of this section details important
ways to ma6e use of that beha/ior. %t also describes alternati/e ways
using fi,ed field locations or the "OSITION parameter.
+-tracting .!ltiple Logical Records
Some data storage and transfer media ha/e fi,ed-length physical records. 2hen the data
records are short3 more than one can be stored in a single3 physical record to use the
storage space efficiently.
%n this e,ample3 SQL*Loader treats a single physical record in the input file as two
logical records and uses two INTO TABLE clauses to load the data into the emp table. For
e,ample3 assume the data is as follows:
...< Smith ..0? ,Konne
..0. Albert ..9? Thomas
The following control file e,tracts the logical records:
INTO TABLE emp
%empno "OSITION%./4( INTE*E! E1TE!NAL-
ename "OSITION%O/.&( $A!(
INTO TABLE emp
%empno "OSITION%.'/0?( INTE*E! E1TE!NAL-
ename "OSITION%0./9?( $A!(
Relati&e Positioning )ased on ,elimiters
The same record could be loaded with a different specification. The following control file
uses relati/e positioning instead of fi,ed positioning. %t specifies that each field is
delimited by a single blan6 0A A1 or with an undetermined number of blan6s and tabs
0#$ITES"AE1:
INTO TABLE emp
%empno INTE*E! E1TE!NAL TE!5INATED B, 6 6-
ename $A! TE!5INATED B, #$ITES"AE(
INTO TABLE emp
%empno INTE*E! E1TE!NAL TE!5INATED B, 6 6-
ename $A!( TE!5INATED B, #$ITES"AE(
The important point in this e,ample is that the second empno field is found immediately
after the first ename3 although it is in a separate INTO TABLE clause. Field scanning does
not start o/er from the beginning of the record for a new INTO TABLE clause. %nstead3
scanning continues where it left off.
To force record scanning to start in a specific location3 you use the "OSITION parameter.
That mechanism is described in $istinguishing $ifferent %nput +ecord Formats and in
Loading $ata into .ultiple Tables.
,isting!ishing ,ifferent Inp!t Record Formats
) single datafile might contain records in a /ariety of formats. Consider the following
data3 in which emp and dept records are intermi,ed:
. &? 5anHfactHrin7 -- DE"T record
0 ...< Smith &? -- E5" record
0 ..0? SnFder &?
. O? Shippin7
0 ..0. SteKens O?
) record %$ field distinguishes between the two formats. $epartment records ha/e a . in
the first column3 while employee records ha/e a 0. The following control file uses e,act
positioning to load this data:
INTO TABLE dept
#$EN recid ) .
%recid FILLE! "OSITION%./.( INTE*E! E1TE!NAL-
deptno "OSITION%9/4( INTE*E! E1TE!NAL-
dname "OSITION%8/0.( $A!(
INTO TABLE emp
#$EN recid PQ .
%recid FILLE! "OSITION%./.( INTE*E! E1TE!NAL-
empno "OSITION%9/O( INTE*E! E1TE!NAL-
ename "OSITION%8/.'( $A!-
deptno "OSITION%.</0?( INTE*E! E1TE!NAL(
Relati&e Positioning )ased on the POSITIO Parameter
The records in the pre/ious e,ample could also be loaded as delimited data. %n this case3
howe/er3 it is necessary to use the "OSITION parameter. The following control file could
be used:
INTO TABLE dept
#$EN recid ) .
%recid FILLE! INTE*E! E1TE!NAL TE!5INATED B, #$ITES"AE-
deptno INTE*E! E1TE!NAL TE!5INATED B, #$ITES"AE-
dname $A! TE!5INATED B, #$ITES"AE(
INTO TABLE emp
#$EN recid PQ .
%recid FILLE! "OSITION%.( INTE*E! E1TE!NAL TE!5INATED B, ' '-
empno INTE*E! E1TE!NAL TE!5INATED B, ' '
ename $A! TE!5INATED B, #$ITES"AE-
deptno INTE*E! E1TE!NAL TE!5INATED B, ' '(
The "OSITION parameter in the second INTO TABLE clause is necessary to load this data
correctly. %t causes field scanning to start o/er at column 5 when chec6ing for data that
matches the second format. 2ithout it3 SQL*Loader would loo6 for the recid field after
dname.
,isting!ishing ,ifferent Inp!t Ro% O#$ect S!#types
) single datafile may contain records made up of row ob"ects inherited from the same
base row ob"ect type. For e,ample3 consider the following simple ob"ect type and ob"ect
table definitions in which a nonfinal base ob"ect type is defined along with two ob"ect
subtypes that inherit from the base type:
!EATE T,"E person:t AS OBIET
%name JA!$A!0%9?(-
a7e N+5BE!%9(( not finalM
!EATE T,"E emploFee:t +NDE! person:t
%empid N+5BE!%&(-
deptno N+5BE!%4(-
dept JA!$A!0%9?(( not finalM
!EATE T,"E stHdent:t +NDE! person:t
%stdid N+5BE!%&(-
ma3or JA!$A!0%0?(( not finalM
!EATE TABLE persons OF person:tM
The following input datafile contains a mi,ture of these row ob"ects subtypes. ) type %$
field distinguishes between the three subtypes. person:t ob"ects ha/e a " in the first
column3 emploFee:t ob"ects ha/e an E3 and stHdent:t ob"ects ha/e an S.
"-Iames-9.-
"-Thomas-00-
E-"at-98-<9O4&-..00-En7ineerin7-
"-Bill-.<-
"-Scott-&&-
S-IHdF-4&-0'9.O-En7lish-
S-2aren-94-8?9&O-$istorF-
E-2aren-O.-<??&O-.909-5anHfactHrin7-
S-"at-0<-<8O0&-Spanish-
S-odF-00-<<'49-5ath-
"-Ted-49-
E-IHdF-44-8'O.O-.&44-AccoHntin7-
E-Bob-&?-O940.-.9.4-Shippin7-
S-Bob-90-O'40?-"sFcholo7F-
E-odF-99-0&.49-.??0-$Hman !esoHrces-
The following control file uses relati/e positioning based on the "OSITION parameter to
load this data. #ote the use of the T!EAT AS clause with a specific ob"ect type name. This
informs SQL*Loader that all input row ob"ects for the ob"ect table will conform to the
definition of the named ob"ect type.
INTO TABLE persons
!E"LAE
#$EN tFpid ) '"' T!EAT AS person:t
FIELDS TE!5INATED B, 6-6
%tFpid FILLE! "OSITION%.( $A!-
name $A!-
a7e $A!(
INTO TABLE persons
!E"LAE
#$EN tFpid ) 'E' T!EAT AS emploFee:t
FIELDS TE!5INATED B, 6-6
%tFpid FILLE! "OSITION%.( $A!-
name $A!-
a7e $A!-
empid $A!-
deptno $A!-
dept $A!(
INTO TABLE persons
!E"LAE
#$EN tFpid ) 'S' T!EAT AS stHdent:t
FIELDS TE!5INATED B, 6-6
%tFpid FILLE! "OSITION%.( $A!-
name $A!-
a7e $A!-
stdid $A!-
ma3or $A!(
See (lso"
Loading Column !b"ects for more information on loading ob"ect types
Loading ,ata into .!ltiple Ta#les
&y using the "OSITION clause with multiple INTO TABLE clauses3 data from a single
record can be loaded into multiple normali=ed tables. See Case Study 4: Loading $ata
into .ultiple Tables.
S!mmary
.ultiple INTO TABLE clauses allow you to e,tract multiple logical records from a single
input record and recogni=e different record formats in the same file.
For delimited data3 proper use of the "OSITION parameter is essential for achie/ing the
e,pected results.
2hen the "OSITION parameter is not used3 multiple INTO TABLE clauses process
different parts of the same 0delimited data1 input record3 allowing multiple tables to be
loaded from one record. 2hen the "OSITION parameter is used3 multiple INTO TABLE
clauses can process the same record in different ways3 allowing multiple formats to be
recogni=ed in one input file.
)ind (rrays and Con&entional Path Loads
SQL*Loader uses the SQL array-interface option to transfer data to the database.
.ultiple rows are read at one time and stored in the bind array. 2hen SQL*Loader sends
the !racle database an INSE!T command3 the entire array is inserted at one time. )fter
the rows in the bind array are inserted3 a O55IT is issued.
The determination of bind array si=e pertains to SQL*LoaderJs con/entional path option.
%t does not apply to the direct path load method because a direct path load uses the direct
path )%3 rather than !racleJs SQL interface.
See (lso"
Oracle Call #nterface $rogrammer!s Guide for more information about
the concepts of direct path loading
Si7e Re8!irements for )ind (rrays
The bind array must be large enough to contain a single row. %f the ma,imum row length
e,ceeds the si=e of the bind array3 as specified by the BINDSI@E parameter3 SQL*Loader
generates an error. !therwise3 the bind array contains as many rows as can fit within it3
up to the limit set by the /alue of the !O#S parameter.
The BINDSI@E and !O#S parameters are described in Command-Line arameters.
)lthough the entire bind array need not be in contiguous memory3 the buffer for each
field in the bind array must occupy contiguous memory. %f the operating system cannot
supply enough contiguous memory to store a field3 SQL*Loader generates an error.
Performance Implications of )ind (rrays
Large bind arrays minimi=e the number of calls to the !racle database ser/er and
ma,imi=e performance. %n general3 you gain large impro/ements in performance with
each increase in the bind array si=e up to 5GG rows. %ncreasing the bind array si=e to be
greater than 5GG rows generally deli/ers more modest impro/ements in performance. The
si=e 0in bytes1 of 5GG rows is typically a good /alue to use.
%n general3 any reasonably large si=e permits SQL*Loader to operate effecti/ely. %t is not
usually necessary to perform the detailed calculations described in this section. +ead this
section when you need ma,imum performance or an e,planation of memory usage.
Specifying !m#er of Ro%s 9ers!s Si7e of )ind (rray
2hen you specify a bind array si=e using the command-line parameter BINDSI@E 0see
&%#$S%P' 0ma,imum si=e11 or the O"TIONS clause in the control file 0see !T%!#S
Clause13 you impose an upper limit on the bind array. The bind array ne/er e,ceeds that
ma,imum.
)s part of its initiali=ation3 SQL*Loader determines the si=e in bytes re;uired to load a
single row. %f that si=e is too large to fit within the specified ma,imum3 the load
terminates with an error.
SQL*Loader then multiplies that si=e by the number of rows for the load3 whether that
/alue was specified with the command-line parameter !O#S 0see +!2S 0rows per
commit11 or the O"TIONS clause in the control file 0see !T%!#S Clause1.
%f that si=e fits within the bind array ma,imum3 the load continues--SQL*Loader does not
try to e,pand the number of rows to reach the ma,imum bind array si=e. #f the number of
ro"s and the ma%imum bind array size are both specified& SQL'Loader al"ays uses the
smaller value for the bind array(
%f the ma,imum bind array si=e is too small to accommodate the initial number of rows3
SQL*Loader uses a smaller number of rows that fits within the ma,imum.
Calc!lations to ,etermine )ind (rray Si7e
The bind arrayJs si=e is e;ui/alent to the number of rows it contains times the ma,imum
length of each row. The ma,imum length of a row is e;ual to the sum of the ma,imum
field lengths3 plus o/erhead3 as follows:
bind arraF siRe )
%nHmber of roLs( > % S+5%fiDed field len7ths(
S S+5%maDimHm KarFin7 field len7ths(
S % %nHmber of KarFin7 len7th fields(
> %siRe of len7th indicator( (
(
.any fields do not /ary in si=e. These fi,ed-length fields are the same for each loaded
row. For these fields3 the ma,imum length of the field is the field si=e3 in bytes3 as
described in SQL*Loader $atatypes. There is no o/erhead for these fields.
The fields that can /ary in si=e from row to row are:
$A!
DATE
INTE!JAL DA, TO SEOND
INTE!JAL DA, TO ,EA!
LON* JA!!A#
numeric E1TE!NAL
TI5E
TI5ESTA5"
TI5E #IT$ TI5E @ONE
TI5ESTA5" #IT$ TI5E @ONE
JA!$A!
JA!$A!
JA!*!A"$I
JA!!A#
JA!!A#
The ma,imum length of these datatypes is described in SQL*Loader $atatypes. The
ma,imum lengths describe the number of bytes that the fields can occupy in the input
data record. That length also describes the amount of storage that each field occupies in
the bind array3 but the bind array includes additional o/erhead for fields that can /ary in
si=e.
2hen the character datatypes 0$A!3 DATE3 and numeric E1TE!NAL1 are specified with
delimiters3 any lengths specified for these fields are ma,imum lengths. 2hen specified
without delimiters3 the si=e in the record is fi,ed3 but the si=e of the inserted field may
still /ary3 due to whitespace trimming. So internally3 these datatypes are always treated as
/arying-length fields--e/en when they are fi,ed-length fields.
) length indicator is included for each of these fields in the bind array. The space
reser/ed for the field in the bind array is large enough to hold the longest possible /alue
of the field. The length indicator gi/es the actual length of the field for each row.
ote"
%n con/entional path loads3 L!&F%L's are not included when
allocating the si=e of a bind array.
,etermining the Si7e of the Length Indicator
!n most systems3 the si=e of the length indicator is C bytes. !n a few systems3 it is 8
bytes. To determine its si=e3 use the following control file:
O"TIONS %!O#S).(
LOAD DATA
INFILE >
A""END
INTO TABLE DE"T
%deptno "OSITION%./.( $A!%.((
BE*INDATA
a
This control file loads a 5-byte $A! using a 5-row bind array. %n this e,ample3 no data is
actually loaded because a con/ersion error occurs when the character a is loaded into a
numeric column 0deptno1. The bind array si=e shown in the log file3 minus one 0the
length of the character field1 is the /alue of the length indicator.
ote"
) similar techni;ue can determine bind array si=e without doing any
calculations. +un your control file without any data and with !O#S). to
determine the memory re;uirements for a single row of data. .ultiply
by the number of rows you want in the bind array to determine the bind
array si=e.
Calc!lating the Si7e of Field )!ffers
Table 4-8 through Table 4-7 summari=e the memory re;uirements for each datatype. ALA
is the length specified in the control file. AA is precision. ASA is the si=e of the length
indicator. For more information on these /alues3 see SQL*Loader $atatypes.
.
Table 5-% Fixe)-Len*th Fiel)s
,atatype Si7e in )ytes 1Operating System-,ependent2
INTE*E!
The si=e of the INT datatype3 in C
INTE*E!%N(
N bytes
,atatype Si7e in )ytes 1Operating System-,ependent2
S5ALLINT
The si=e of S$O!T INT datatype3 in C
FLOAT
The si=e of the FLOAT datatype3 in C
DO+BLE
The si=e of the DO+BLE datatype3 in C
B,TEINT
The si=e of +NSI*NED $A!3 in C
JA!!A#
The si=e of +NSI*NED S$O!T3 plus 9GN7 bytes or whate/er is specified as
max_length
LON*
JA!!A#
The si=e of +NSI*NED INT3 plus 9GN7 bytes or whate/er is specified as
max_length
JA!$A!
Composed of C numbers. The first specifies length3 and the second 0which
is optional1 specifies max_length 0default is 9GN7 bytes1.
JA!!A#
This datatype is for !A# data. %t is composed of C numbers. The first
specifies length3 and the second 0which is optional1 specifies max_length
0default is 9GN7 bytes1.
Table 5-' Non*raphi+ Fiel)s
,atatype ,efa!lt Si7e Specified Si7e
%pacTed( DEI5AL
#one 0#O51EC3 rounded up
@ONED
#one
!A#
#one L
$A! 0no delimiters1 5 LOS
datetime and inter/al 0no delimiters1 #one LOS
,atatype ,efa!lt Si7e Specified Si7e
numeric E1TE!NAL 0no delimiters1 #one LOS
Table 5-5 ,raphi+ Fiel)s
,atatype ,efa!lt Si7e
Length Specified
%ith POSITIO
Length Specified
%ith ,(T(T:P+
*!A"$I
#one L C*L
*!A"$I
E1TE!NAL
#one L - C C*0L-C1
JA!*!A"$I
9Db*C LOS 0C*L1OS
Table 5-- $ariable-Len*th Fiel)s
,atatype ,efa!lt Si7e
.a-im!m Length
Specified 1L2
JA!$A!
9Db LOS
$A! 0delimited1 C44 LOS
datetime and inter/al 0delimited1 C44 LOS
numeric E1TE!NAL 0delimited1 C44 LOS
.inimi7ing .emory Re8!irements for )ind (rrays
ay particular attention to the default si=es allocated for JA!$A!3 JA!*!A"$I3 and the
delimited forms of $A!3 DATE3 and numeric E1TE!NAL fields. They can consume
enormous amounts of memory--especially when multiplied by the number of rows in the
bind array. %t is best to specify the smallest possible ma,imum length for these fields.
Consider the following e,ample:
$A!%.?( TE!5INATED B, 6-6
2ith byte-length semantics3 this e,ample uses 05G O C1 * 79 R I7F bytes in the bind array3
assuming that the length indicator is C bytes long and that 79 rows are loaded at a time.
2ith character-length semantics3 the same e,ample uses 005G * s1 O C1 * 79 bytes in the
bind array3 where AsA is the ma,imum si=e in bytes of a character in the datafile character
set.
#ow consider the following e,ample:
$A! TE!5INATED B, 6-6
+egardless of whether byte-length semantics or character-length semantics are used3 this
e,ample uses 0C44 O C1 * 79 R 57399F bytes3 because the default ma,imum si=e for a
delimited field is C44 bytes. This can ma6e a considerable difference in the number of
rows that fit into the bind array.
Calc!lating )ind (rray Si7e for .!ltiple ITO T()L+ Cla!ses
2hen calculating a bind array si=e for a control file that has multiple INTO TABLE clauses3
calculate as if the INTO TABLE clauses were not present. %magine all of the fields listed in
the control file as one3 long data structure--that is3 the format of a single row in the bind
array.
%f the same field in the data record is mentioned in multiple INTO TABLE clauses3
additional space in the bind array is re;uired each time it is mentioned. %t is especially
important to minimi=e the buffer allocations for such fields.
ote"
(enerated data is produced by the SQL*Loader functions ONSTANT3
E1"!ESSION3 !EN+53 S,SDATE3 and SEU+ENE. Such generated data
does not re;uire any space in the bind array.