Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL*Loader - How to load columns from previous columns? 1

Status
Not open for further replies.

wellster34

Programmer
Sep 4, 2001
113
CA
Hi,

I have a table that has the following:

LEVEL_ID CHAR(2)
LEVEL_DESC_TX VARCHAR2(240)
LEVEL_CAT_TX VARCHAR2(240)

The data file contains a pipe delimited file:

1|FIRST LEVEL|
2|SECOND LEVEL|
3|THIRD LEVEL|
...etc...

The LEVEL_CAT_TX field, I need to merge the contents of the LEVEL_ID & LEVEL_DESC_TX with a hyphen in between.

i.e.
1 - FIRST LEVEL
2 - SECOND LEVEL


Is there a way to populate this 3rd column (LEVEL_CAT_TX) when loading the data??? Or do I have to create a PL/SQL process afterwards to do the concatenation???

Thanks for your time.
 

Try this:
Code:
LOAD DATA
INFILE * 
INSERT INTO TABLE MyTable
FIELDS TERMINATED BY "|" TRAILING NULLCOLS
(level_id
,level_desc_tx
,level_cat_tx ":level_id||' - '||:level_desc_tx"
)
BEGINDATA
1|FIRST LEVEL|
2|SECOND LEVEL|
3|THIRD LEVEL|
[3eyes]

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top