My Oracle Support Banner

SQL*Loader Cannot Load Some Raw Data When NLS_LANG is Multi-Byte (Doc ID 2065115.1)

Last updated on AUGUST 04, 2018

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.1 and later
Information in this document applies to any platform.

Symptoms

SQL * LOADER will not successfully load the binary data to RAW datatype column, if the following conditions are met:

  1. You have specified the multi-byte character set to NLS_LANG and Database.
  2. The record delimiter is specified after binary data(binary data is specified as last column in loader control file).
  3. Binary data's last byte is first byte of multi-byte charcterset.
  4. The record delimiter is more than 2 bytes.


Example:

If you have set the NLS_LANG to the character set JA16SJIS and run the data load with the SQL * Loader as following:

-- Table definition

create table test_tab (RDAT RAW (3));

-- Input file [test.dat]

-- the Character is described by Hexadecimal for easy understanding the record delimiter is '!#' Hex:21,23

F1,F2,F3,21,23,F1,F2,F3,21,23


-- Control file [test.ctl]

LOAD DATA INFILE 'test.dat' "STR '!#'"

truncate INTO TABLE test_tab (RDAT POSITION(*) RAW(3))


-- executing with following command:

sqlldr scott/tiger control=test.ctl bad=test.bad log=test.log

-- Execution result

コミット・ポイントに達しました。 - 論理レコード件数1★

-- above message translating to:
-- "We have reached the commit point. - Logical record number 1 ★"


SQL> select * from test_tab;

RDAT
------
F1F2F3

 

As per above example, it expects loading 2 records to table test_tab.

However, because all the following conditions are met, sqlldr cannot find end of record and as a result, sqlldr acts as skipping the next record.

  1. NLS_LANG and Database is set to JA16SJIS (※)
  2. the record delimiter '!#'is specified after binary data.
  3. binary data's last byte (F3) is first byte of shift-jis charcterset.※1
  4. the record delimiter '!#' is more than 2 bytes.

※1.  JA16SJIS's multi-byte scope is as below:

1st byte: 0x81-0x9F、0xE0-0xFC

2ed byte: 0x40-0x7E、0x80-0xFC

 

Cause

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
Symptoms
Cause
Solution
References


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