dbTalk Databases Forums  

Calling SQL functions with SQL loader to concatenate, ADD, etc... fields

comp.databases.oracle.tools comp.databases.oracle.tools


Discuss Calling SQL functions with SQL loader to concatenate, ADD, etc... fields in the comp.databases.oracle.tools forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
LID
 
Posts: n/a

Default Calling SQL functions with SQL loader to concatenate, ADD, etc... fields - 05-03-2006 , 02:10 AM






Hi All,

I have a flat file as follows:
ID,Name1,Name2,height1,height2
12,Test,X,12,13
13,Test2,Y,14,16

I need an sql loader control file that concatenates Name1 and Name2
into one db field and add up height1 and height 2 into one field so
that I can get the following result in the following table:

ID, Name, Height
12, TestX, 25
13, Test2Y, 30

Thanks a lot for providing me with a CTL file example that can do that.

Regards,
Walid


Reply With Quote
  #2  
Old   
Volker Pohlers
 
Posts: n/a

Default Re: Calling SQL functions with SQL loader to concatenate, ADD, etc...fields - 05-03-2006 , 04:40 AM






Hi, this works (tested on Oracle 9.2):

load data
infile *
replace
into table EXT_TEST
fields terminated by ','
trailing nullcols
(
ID,
NAME1 BOUNDFILLER,
NAME ":NAME1||:NAME",
HEIGHT1 BOUNDFILLER,
HEIGHT ":HEIGHT1+:HEIGHT"
)
BEGINDATA
12,Test,X,12,13
13,Test2,Y,14,16

------------

ID NAME HEIGHT
-- ---------- --------------
12 TestX 25
13 Test2Y 30


greetings
Volker

Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default Re: Calling SQL functions with SQL loader to concatenate, ADD, etc... fields - 05-03-2006 , 06:47 AM




LID wrote:
Quote:
Hi All,

I have a flat file as follows:
ID,Name1,Name2,height1,height2
12,Test,X,12,13
13,Test2,Y,14,16

I need an sql loader control file that concatenates Name1 and Name2
into one db field and add up height1 and height 2 into one field so
that I can get the following result in the following table:

ID, Name, Height
12, TestX, 25
13, Test2Y, 30

Thanks a lot for providing me with a CTL file example that can do that.

Regards,
Walid
Please don't ask doc questions here, but read the manual.

--
Sybrand Bakker
Senior Oracle DBA



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.