SQL *Loader Question

Hi,

I am very new to SQL *Loader. We are starting to use SQL *Loader to load the data in to a table.
If I want to populate a column in the table concatinating with two other columns together..

Is it possible to do this???

I am posting my code.


LOAD DATA
   INFILE 'XXX.dat'
   REPLACE
   INTO TABLE LOAD
  (A POSITION(05:19) CHAR,
   B    POSITION(189:197)  CHAR,
    C  EXPRESSION "TRUNC(Last_day(add_months(sysdate, -1)))",
    D  EXPRESSION "A||C" 'populate D column woth A AND C)

Any help is appriciated.


Thanks
Madhavi



RegulapatiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MikeOM_DBACommented:
Try this:

LOAD DATA
   INFILE 'XXX.dat'
   REPLACE
   INTO TABLE LOAD
  (A POSITION(05:19) CHAR,
   B    POSITION(189:197)  CHAR,
    C "TRUNC(Last_day(add_months(sysdate, -1)))",
    D  ":A||:C")

0
RegulapatiAuthor Commented:
HI Mike,

Thanks for the reply.

Did not work,


Error Message is  "not all variables bound" on
SQL string for column : ":A||:C" line.

Please let me know if I have to do any thing else...

Thanks
Madhavi

0
seazodiacCommented:
the problem here is that C column is also derived from a function and it's a DATE data type.

can you try this ?

LOAD DATA
  INFILE 'XXX.dat'
  REPLACE
  INTO TABLE LOAD
 (A POSITION(05:19) CHAR,
   B    POSITION(189:197)  CHAR,
   C "TRUNC(Last_day(add_months(sysdate, -1)))",
   D  ":A||to_char(:C)")
0
MikeOM_DBACommented:
OK, or maybe like this:

LOAD DATA
   INFILE 'XXX.dat'
   REPLACE
   INTO TABLE LOAD
  (A POSITION(05:19) CHAR,
   B    POSITION(189:197)  CHAR,
    C "TRUNC(Last_day(add_months(sysdate, -1)))",
    D  ":A||TRUNC(Last_day(add_months(sysdate, -1)))")
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RegulapatiAuthor Commented:
Hi Mike and  seazodiac,

Thanks for the reply.


I tried Mike's Solution and it worked.


Thanks again for the help


Madhavi
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.