Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Substr function in CTL file of sqlloader

734241Jul 23 2010 — edited Jul 26 2010
Hi gurus,

I am using sql loader to load the data from text file to oracle table.
I have 2 columns in the input data, which are of more size than their corresponding destination table column sizes.
I am using substr() function in the control file, but it is failing for some records in 2 scenarios, details given below.

First scenario:
--------------
destination table column size is 250 characters.
substr() function works fine when the source data is less than 255 characters, but when it is more than 255 characters, the record is getting rejected as bad record.

eg: if the source data is of 254 characters, only 250 chars are inserted in the table, but if the size is 256, record is not inserted in the table.

Here is the syntax i am using
ENQUIRY "SUBSTR(:ENQUIRY, 0, 250)",

Second scenario:
---------------
destination table column size is 2000 characters.
substr() function works fine when the source data is upto 2000 characters, but when it is more than 2000 characters, the record is getting rejected as bad record.


Here is the syntax i am using
ANSWER CHAR(2000) "SUBSTR(:ANSWER, 0, 2000)",

Please suggest.

Thanks,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 23 2010
Added on Jul 23 2010
5 comments
21,599 views