oracle - Update specific rows in a column -


i have column 82 rows(from table1) , want update 76 rows in different values table(table2). avoiding 6 specific rows(1, 10, 38, 39, 46, 77). leaving these rows null values.

i used cursor save 76 rows table2

cursor my_cur    select * table2 

then tried update table1

begin  x in  my_cur loop    update table1    set my_col = x.acct_num    rnum not in ('1', '10', '38', '39', '46', '77'); end loop; end; 

but ended updating these rows same value(only 1 acct_num 76 rows).

i want enter different acct_num 76 rows , in same order in table2

i added rownum in both of them have @ least sure rows skip. ideas how it? thanks.

in update query,as loop hence last value of acct_num table1 loop gets updated rows table2.

there must common column join between table1 , table2 use in condition.

begin  x in  my_cur loop    update table1    set my_col = x.acct_num    table1.common_column = x.common_column , rnum not in ('1', '10', '38', '39', '46', '77'); end loop; end; 

this additional filter in clause can solve ur query.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -