create or replace function act(v varchar(25)) returns void as
'
declare
c1 cursor for select * from actor where aname = v;
c2 cursor for select * from moviact;
c3 cursor for select * from movie;
r1 actor%rowtype;
r2 moviact%rowtype;
r3 movie%rowtype;
begin
open c1 ;
loop
fetch c1 into r1;
exit when not found;
open c2;
loop
fetch c2 into r2;
exit when not found;
if r1.aid = r2.aid then
open c3;
loop
fetch c3 into r3;
exit when not found;
if r2.mid = r3.mid then
raise notice ''% % '',r3.mid,r3.mname;
end if;
end loop;
close c3;
end if;
end loop;
close c2;
end loop;
close c1;
end;
'language'plpgsql';
Acode2=# select shaikh3('Dnagal');
o\p
NOTICE: 2018 ₹2,500,000.00
shaikh3
---------
0
(1 row)
0 Comments