RE: SQL*Loader refuses to load second INTO block

  • From: Rich J <rjoralist3@xxxxxxxxxxxxxxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Fri, 23 Oct 2015 09:03:07 -0500



On 2015/10/22 22:18, Gary Gruber wrote:

I seem to recall beating my head against that particular issue quite a while
back.

A quick google refreshed my memory. When reading delimited records,
SQL*Loader does not rewind back to the first position to evaluate the next
"when" clause. Believe it or not, the old 9.2 docs describe the issue better
than anything current I could find.

https://docs.oracle.com/cd/B10501_01/server.920/a96652/ch05.htm#1005802 [1]

That's it! Once I changed the "gl_cat" column in the _second_ INTO
clause to have a "position(01)", everything is parsing out perfectly.

I completely missed that requirement! Now that you pointed it out, I can
see this behavior listed in newer docs, too:

https://docs.oracle.com/cd/B28359_01/server.111/b28319/ldr_control_file.htm#sthref1038
[2]

Thanks much, Gary!

Rich

FROM: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] ON
BEHALF OF Rich J
SENT: Thursday, October 22, 2015 9:52 PM
TO: Oracle L
SUBJECT: SQL*Loader refuses to load second INTO block

Hey all,

I'm using SQL*Loader 11.2.0.3 to dump a pipe-delimited report with multiple
formats (e.g. block headings and detail rows) into multiple tables, using
WHEN to split them up. Here's a sanitized version of the controlfile:

OPTIONS (READSIZE=4194304, BINDSIZE=4194304, ROWS=512, ERRORS=99999999,
SKIP=1)
LOAD DATA
INFILE 'GLStuff.txt'
APPEND
INTO TABLE gl_accounts
WHEN gl_cat = 'Expenses'
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
(
gl_cat CHAR,
gl_acct CHAR,
filler00 FILLER,
filler01 FILLER,
filler02 FILLER,
filler03 FILLER,
filler04 FILLER,
filler05 FILLER,
gl_acct_desc CHAR
)
INTO TABLE gl_accounts
WHEN gl_cat = 'Cost of Sales'
FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
(
gl_cat CHAR,
gl_acct CHAR,
filler00 FILLER,
filler01 FILLER,
filler02 FILLER,
filler03 FILLER,
filler04 FILLER,
filler05 FILLER,
gl_acct_desc CHAR
)


Links:
------
[1]
https://docs.oracle.com/cd/B10501_01/server.920/a96652/ch05.htm#1005802
[2]
https://docs.oracle.com/cd/B28359_01/server.111/b28319/ldr_control_file.htm#sthref1038

Other related posts: