A VARCHAR
field is a length-value data type. It consists of a binary length subfield followed by a character string of the specified length. The length is in bytes unless character-length semantics are used for the data file. In that case, the length is in characters. See "Character-Length Semantics".
VARCHAR
fields can be loaded with correct results only between systems where a SHORT
data field INT
has the same length in bytes. If the byte order is different between the systems, or if the VARCHAR
field contains data in the UTF16 character set, then use the appropriate technique to indicate the byte order of the length subfield and of the data. The byte order of the data is only an issue for the UTF16 character set. See "Byte Ordering".
The size of the length subfield is the size of the SQL*Loader SMALLINT
data type on your system (C type SHORT
INT
). See "SMALLINT" for more information.
The syntax for the VARCHAR
data type is:
A maximum length specified in the control file does not include the size of the length subfield. If you specify the optional maximum length for a VARCHAR
data type, then a buffer of that size, in bytes, is allocated for these fields. However, if character-length semantics are used for the data file, then the buffer size in bytes is the max
_length
times the size in bytes of the largest possible character in the character set. See "Character-Length Semantics".
The default maximum size is 4 KB. Specifying the smallest maximum length that is needed to load your data can minimize SQL*Loader's memory requirements, especially if you have many VARCHAR
fields.
The POSITION
clause, if used, gives the location, in bytes, of the length subfield, not of the first text character. If you specify POSITION(start:end)
, then the end location determines a maximum length for the field. Start
is subtracted from (end + 1)
to give the length of the field in bytes. If a maximum length is specified, then it overrides any length calculated from POSITION
.
If a VARCHAR
field is truncated by the end of the logical record before its full length is read, then a warning is issued. Because the length of a VARCHAR
field is embedded in every occurrence of the input data for that field, it is assumed to be accurate.
VARCHAR
data cannot be delimited.