Hi

Feels somewhat complicated, but no so!!!!

For a particular program, I plan to use many DML in a loop as given below. Please suggest me if it will have a adverse effect on the database.

In my application, I have a table(A) with 2 columns
(Account_number & accoutn_no_changed_to)

Entries in A look like

Acc_No(A1) Acc_change_to(A2)
1 10
2 3
3 4
5 6


I need to update this with the account table. So I use this logic

i=1;
while i > 0
{ insert into B using self join A2= B1 ; // B is similar to A;
delete from A for all rows in B;
update account from A;
truncate A;
rename A to C; // for swaping tables;
rename B to A;
rename C to B;
i = select count(*) from A;
}

1)If It is clear
a) Please tell me having so many DML's effect on DB
b) Is there a better way of doing it;


Badrinath.