My Oracle Support Banner

Direct Path Load Silently Inserts Strings That Exceed Column Length (Doc ID 1277810.1)

Last updated on FEBRUARY 25, 2019

Applies to:

Oracle Database - Enterprise Edition - Version to [Release 11.1 to 11.2]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.


You started SQL*Loader in direct path mode into a multibyte database using character length semantics and observed that some of the inserted records exceed the defined column length. The following example demonstrates this:

-- create the environment (in database on multibyte character set, like AL32UTF8/UTF8)
create user test identified by test default tablespace users temporary tablespace temp;
grant connect, resource to test;

connect test/test

create table a_tab
   len  number,
   text varchar2(10 char)

-- SQL*Loader control file ldr.ctl
options (direct=true)
load data
characterset utf8
infile 'ldr.dat'
into table a_tab
fields terminated by ';'
trailing nullcols
   text "ltrim (:text)"

-- input file ldr.dat

Start SQL*Loader with:

#> sqlldr test/test control=ldr.ctl

This returns (in log file):

Table A_TAB:
2 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.

Verify the table in SQL*Plus:

SQL> select len, text, length (text), dump (text, 16) from a_tab;

LEN        TEXT       LENGTH(TEXT)
---------- ---------- ------------
         8 ABCDEFGH              8
Typ=1 Len=8: 41,42,43,44,45,46,47,48

        20 1234567890           20
Typ=1 Len=20: 31,32,33,34,35,36,37,38,39,30,31,32,33,34,35,36,37,38,39,30

=> The column TEXT contains 20 characters despite definition VARCHAR2(10 CHAR).




To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.