If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

I have a question regarding the sqlldr in oracle. It is about the control file. I have a input .csv file, and I would like to load the csv column 'COUPON' to two of my database columns, let's say 'INTEREST_RATE' and 'COUPON'. is it possible to do that in sqlldr? How should the control file look like? Please take a look at what I have here.

First install the delimited package( code is below ), you can then load whatever columns you want. The below control file would load columns 1 and 4 of the input data, skipping columns 2 and 3. The way this works is that FIELD1 is mapped to the entire INPUT record (postion 1-4096 or whatever your max record may be). We send field1 down to the delimited.word subroutine for EVERY column. The delimited.word routine compares the string it was called with against the last string it parsed and if they differ -- delimited.word parses the string and caches the results .
create or replace package delimited
as
function word( p_str in varchar2,
p_n in varchar2,
p_enclosed_by in varchar2 default '''',
p_separated_by in varchar2 default ',' )
return varchar2;

pragma restrict_references( word, WNDS, RNDS );
end;
/

create or replace package body delimited
as
type vcArray is table of varchar2(2000) index by binary_integer;