0
votes

I have data in a table(3 columns out of which 2 columns already have data). I have a text file which has three fields. Now, can I use sql loader to update the third column in table using the value in 3rd field in the text file?

1
can you give a hint how to do so? Thank you - Deepak K M
write your update statement in quotes after the field name with the conditions you need - Vamsi Prabhala
@vkp: SQL*Loader can not update rows, it can only insert new rows. - a_horse_with_no_name
@a_horse_with_no_name..thank you. I thought any statement could be used. - Vamsi Prabhala
So is there no way i can use sql loader in this case? other than creating a new table, loading the data in that table first and then using a procedure to update the main table accordingly. - Deepak K M

1 Answers

1
votes

The only two ways I know for making this work are:

  1. Using an external table, which allows the file to be treated as a table which can be queried, and which can be used as part of an update statement. Excellent performance and flexibility!
  2. Using SQL*Loader to insert into a view against which is defined an "INSTEAD OF INSERT" trigger which executes an update statement. This means performing row-by-row processing, so it is slower than external tables. It is not very elegant, and requires PL/SQL of course, but makes the execution of arbitrary SQL statements based on SQL*Loader inserts possible.