Re: simultaneous access of two tables
From: Kim Ng <kimmng_at_pebbles.uswnvg.com>
Date: 1995/05/31
Message-ID: <3qict5$ca0_at_fred.uswnvg.com>#1/1
FOR i in get_data LOOP
END LOOP;
END; Have fun.
Whatever I say and own are mine, mine and only mine! Received on Wed May 31 1995 - 00:00:00 CEST
Date: 1995/05/31
Message-ID: <3qict5$ca0_at_fred.uswnvg.com>#1/1
How about:
update table1 x1
set x1.col1 = (select x2.col1 from table2 x2 where x2.col_y = x1.col_x);
Of course, the above works fine if you are updating only one column. For multiple columns, it becomes cumbersome. Use PL/SQL for multiple columns such as:
DECLARE CURSOR get_data IS
select t2.col1, t2.col2, t2.col3, t2.col_y from t1, t2 where t1.col_x = t2.col_y;BEGIN
FOR i in get_data LOOP
update t1 set col1 = i.col1, col2 = i.col2, col3 = i.col3 where col_y = i.col_x;
END LOOP;
END; Have fun.
Kim Ng
Whatever I say and own are mine, mine and only mine! Received on Wed May 31 1995 - 00:00:00 CEST