You are on page 1of 1

create table b1 (id number, name varchar2(30));

insert into b1 values(100, 'sathis');


insert into b1 values(200, 'vinoth');
insert into b1 values(300, 'saravanan');
create table b2 (id number, name varchar2(30));
create table b3 (id number, name varchar2(30));
create table b4 (id number, name varchar2(30));
insert into b4 values(200,'vinoth');
select * from b1;
set serveroutput on;
declare
cursor c1 is select * from b1 ;
type vino is table of c1%rowtype;
x vino;
begin
open c1;
loop
fetch c1 bulk collect into x ;
for i in 1..x.count loop
if x(i).id>200 then
insert into b2 values(x(i).id,x(i).name);
elsif x(i).id<200 then
insert into b3 values(x(i).id,x(i).name);
elsif x(i).id=200 then
delete b4 where id=x(i).id;
end if;
end loop;
EXIT WHEN C1%NOTFOUND;
end loop;
close c1;
end;

select * from b2;


select * from b3;
select * from b4;

You might also like