30.5.09

Update using cursor in Oracle

My first ariticle in Oracle:

Nowadays, am becoming oracle developer in develping some funny scripts. Obviosly, am maintaining some standards in writing my scripts. In my first article, I am trying to update a table based on the records from the second table.

-- Am trying to create two new tables.
create table aa1(id int,name char(10))

create table aa(id int,name char(10))

insert into aa values(1,'venkat')

insert into aa1 values(1,'venkat1')

-------------Venkat's First Oracle Cursor -------------------------
create or replace procedure Venkat_FirstOracleCursor as
cursor cur_SubLoans is

select id from aa;begin for id1 in cur_SubLoans loop

begin

for id1 in cur_SubLoans loop

update aa1 sid set sid.id = 0 where sid.id = id1.id;

end loop;

end Venkat_FirstOracleCursor;

No comments:

Post a Comment