SELECT in SQL Loader [message #144667] |
Thu, 27 October 2005 11:05 |
chinnu_e
Messages: 1 Registered: October 2005 Location: Hyderabad
|
Junior Member |
|
|
Hi,
It is required to load data from a .csv file to a table with few additional columns which have to be selected from other tables based on data in .csv file.
Say for ex. the file has VendorID column in it and I want to populate pary_id from hz_parties table simultaneously while loading data.
Any help would be appreciable.
Thanks in advance!
|
|
|
|
Re: SELECT in SQL Loader [message #145682 is a reply to message #144667] |
Fri, 04 November 2005 15:45 |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
Here's another way:
create functions that return the values you need and call those functions in the SQL*Loader control file as such:
.
.
vendor_id,
pary_id "function1(:vendor_id)",
hz_parties "function2(:vendor_id)",
.
.
.
Note that this is 2 extra hits on the database for each row loaded, so it may be very slow. Also, if any row being inserted may be used by another rows being loaded, you'll need to set BINDSIZE to 1 so that a commit happens after every row (even slower).
|
|
|
Re: SELECT in SQL Loader [message #254257 is a reply to message #144667] |
Thu, 26 July 2007 05:42 |
theevildevil
Messages: 10 Registered: February 2007
|
Junior Member |
|
|
Err...i see that this is 2005 doubt but i am also facing the same.
Will anyone redirect me on how to write the 'functions' ? i mean where to write them ..in control file ?
if one could compelte the syntax, i will hughly appreciate it.
thanks in advance.
Regards
Nilesh
|
|
|
Re: SELECT in SQL Loader [message #254262 is a reply to message #144667] |
Thu, 26 July 2007 05:49 |
theevildevil
Messages: 10 Registered: February 2007
|
Junior Member |
|
|
Adding more clarification to my problem:
I have an input .csv file for 4 columns which might contain blanks for the 4th column. the first 3 also form composite primary key for another table say Table B.
My issue is I wish to input the .csv data into table A. but when 4th column in .csv is null, it should find the unique value using the first 3 columns (none of them is null in the csv ...so no recursive issue) from Table B (as mentioned above) and insert it into Table A.
I know that I have to use functions but i am unable to find material for it.
Please help me along with syntax.
Thanks again.
Nilesh.
[Updated on: Thu, 26 July 2007 05:51] Report message to a moderator
|
|
|
|
Re: SELECT in SQL Loader [message #254286 is a reply to message #144667] |
Thu, 26 July 2007 06:32 |
theevildevil
Messages: 10 Registered: February 2007
|
Junior Member |
|
|
Hey Michel,
Thanks for the advice.That was way too quick.God Bless you.
But is it really not possible using SQlLoader ? I am asking this because I am trying to write some scripts which will upload data into the database which also generates Log of the activities done. My senior asked me to use any delivered tool prefereably since their funtionality and power are known and time tested. We wanted tracebility in whatever we are doing.
So what is you valuable advice in the matter ?
Thanks again for the quick reply.
Regards
Nilesh
|
|
|
|
|
|
|
|
Re: SELECT in SQL Loader [message #254507 is a reply to message #254425] |
Fri, 27 July 2007 00:19 |
theevildevil
Messages: 10 Registered: February 2007
|
Junior Member |
|
|
Littlefoot wrote on Fri, 27 July 2007 00:15 | Even better!
|
Sorry but I didnt get that.
Do you mean, using 10g is good?
or using external files is good?
Thanks.
Regards
Nilesh
|
|
|
|
Re: SELECT in SQL Loader [message #254626 is a reply to message #144667] |
Fri, 27 July 2007 05:22 |
theevildevil
Messages: 10 Registered: February 2007
|
Junior Member |
|
|
haha..lol..
good one. Littlefoot.
Yeah, Seniors agreed when I portrayed more SQL possibilities in using External tables.
Thanks a lot Michel and Littlefoot.
God Bless You.
Regards
Nilesh
|
|
|