Thursday 12 January 2023

PostgreSQL Cursors || Cursors Available In PostgreSQL || Part 3 For Loop...


Only 3.9% of viewers are subscribing to my channel 😓.
I request you to please give click on Subscribe button.
It really helps me grow 😢.




call for_loop_cursor(1);

create or replace procedure for_loop_cursor(in_actor_id in integer)
language plpgsql
as $$
declare
lv_string character varying(200);
loop_rec record;
begin
for loop_rec in 
select f.title from film_actor fa,film f 
where fa.film_id = f.film_id 
and actor_id = in_actor_id
LOOP
lv_string := 'Title: '||loop_rec.title;
raise notice '%',lv_string;
end loop;
exception when others then
raise notice 'Something Went Wrong';
end;
$$

No comments:

Post a Comment