Home » RDBMS Server » Server Utilities » Field in data file exceeds maximum length
Field in data file exceeds maximum length [message #70693] Mon, 15 July 2002 07:25 Go to next message
steph
Messages: 15
Registered: July 2002
Junior Member
Hi,
I'm trying to load data that's longer than the 4000 character limit for varchar2(4000). I don't mind losing the extra characters so I'm using the SUBSTR
command on the field "ACTION_TEXT" but ignore's it
and refuses to load my records where that field is
longer than 4000 characters.... what am I doing wrong?

load data
infile 'TPR_CMP_TIME_SHEET.DAT' "str '<er>'"
into table TPR_CMP_TIME_SHEET
REPLACE
fields terminated by '<ec>'
TRAILING NULLCOLS
(REGIONAL_OFFICE_NUMBER ,
REFERENCE_ID ,
SEQUENCE_NO ,
DATE_F ,
AUTHOR_NAME ,
ACTION_TYPE_CODE ,
ACTION_TEXT CHAR(4000) "SUBSTR(:ACTION_TEXT, 1, 4000)" ,
TIME_F ,
BF_DATE ,
WP_ATTACH_IND ,
WP_ATTACHEMENT ,
MOD_DATE ,
MOD_USER )

Thanks,
Steph
Re: Field in data file exceeds maximum length [message #70695 is a reply to message #70693] Mon, 15 July 2002 08:40 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Does record have multiple newlines or carriage returns in them?
You may need to use the "stream record format" option in SQLLDR to load fields that have multiple lines (carriage returns, or linefeeds) in them.

refer
Oracle8i Utilites Guide, chapter 1 under "Stream Record Format
Re: Field in data file exceeds maximum length [message #70697 is a reply to message #70693] Mon, 15 July 2002 12:37 Go to previous messageGo to next message
steph
Messages: 15
Registered: July 2002
Junior Member
I assume that by the 'STREAM' option you imply fields
of variable lenght delimited by a special character,
(called [["str terminator_string"]] in the documentation)
either a ASCII or the equivalent in Hexadecimal format

My flat file is delimited as follows:
-records are delimited by '3C65723E' and
-fields are delimited by '3C65633E' in hexadecimal format

ex:

load data
infile 'TPR_CMP_TIME_SHEET.DAT' "str X'3C65723E'"
into table TPR_CMP_TIME_SHEET
fields terminated by X'3C65633E'

I've tried both the hexadecimal and the equivalent ASCII delimiters in my control file with the same
result.

I don't have any problems with the delimiters if the
field lenght is less than 4000 characters, so I question why this would be an issue.

I'm using SQL*Loader: Release 9.0.1.1.1 on WinNT
and SQL*Loader: Release 9.0.1.0.0 on SunOS 5.7
(I've tried both platforms with the same result)

Steph
Re: Field in data file exceeds maximum length [message #70699 is a reply to message #70697] Mon, 15 July 2002 13:11 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Initially i thought it was becuase of the carriage returnsline feeds. And i dont think we can violate this maximum width.
So there are 2 possible workarounds.
1. Use a CLOB datatype for the column.
2. Split the row into two parts and store with a unique identifier for each row part in another table.
Re: Field in data file exceeds maximum length [message #70706 is a reply to message #70697] Tue, 16 July 2002 05:01 Go to previous messageGo to next message
steph
Messages: 15
Registered: July 2002
Junior Member
That doesn't work.... it rejects every record that contains an "ACTION_TEXT"
field that is longer than 255 characters... instead
of every every record that contains an "ACTION_TEXT"
field that is longer than 4000 characters.

I don't mind losing the tail end of the field if Oracle
will accept my record.

It really seems like it's the 'SUBSTR' function that's
not working like I expect it too.

Any other ideas?

Steph
Re: Field in data file exceeds maximum length [message #70708 is a reply to message #70697] Tue, 16 July 2002 09:52 Go to previous messageGo to next message
steph
Messages: 15
Registered: July 2002
Junior Member
Can this be the reason for my troubles?

'If the SQL string contains a bind variable, the
bind variable cannot be longer than 4000 bytes
or the record will be rejected.'

Utilities documentation chapter 6 page50.

Steph
Re: Field in data file exceeds maximum length [message #70710 is a reply to message #70697] Tue, 16 July 2002 12:04 Go to previous messageGo to next message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
I have nooo idea.
This is really wierd.
Trust me, we are missing something very basic.
anyhow, here is a possible workaround with awk scripting.

RE: SQL Loader:How to load data with carriage return embedded
Re: Field in data file exceeds maximum length [message #71629 is a reply to message #70693] Thu, 05 December 2002 16:30 Go to previous messageGo to next message
Anthony
Messages: 48
Registered: September 2000
Member
I just hit the same problem.
Try the following workaround:

put in option direct=Y

It works for me somehow
( I dug this up from metalink)
Re: Field in data file exceeds maximum length [message #71634 is a reply to message #71629] Fri, 06 December 2002 09:25 Go to previous messageGo to next message
steph
Messages: 15
Registered: July 2002
Junior Member
We ended up changing the datatype in oracle to long
from varchar2(4000)... the data will load successfully
and then you can use some PL/SQL to modify it in ORACLE.

Steph
Re: Field in data file exceeds maximum length [message #71925 is a reply to message #70693] Wed, 05 February 2003 18:14 Go to previous message
Shan
Messages: 14
Registered: December 1999
Junior Member
This is due to restriction in sql*ldr default column length of 255 (Note this is as per version 8.1.5)

LOAD DATA
INFILE 'c:footest.txt'
INSERT
INTO TABLE testing
FIELDS TERMINATED BY ','
(col1,col2,col3,col4 char(4000),col5)

Hope this helps
shan
Previous Topic: oracle 9i upgrade
Next Topic: SQLLdr: What is the use of "FILE" Clause
Goto Forum:
  


Current Time: Wed May 15 08:23:14 CDT 2024