Friday 13 January 2023

PostgreSQL Refcursor || Cursors In PostgreSQL || Part 4 Refcursor Cursor...


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 😢.


select refcursor_cursor(1,'lv_refcursor');
fetch all in lv_refcursor;

create or replace function refcursor_cursor(in_actor_id in integer, lv_ref_cur refcursor)
returns refcursor
language plpgsql
as $$
begin
open lv_ref_cur
for select 'Title: '||f.title as Title
from film_actor fa, film f
where fa.film_id = f.film_id
and fa.actor_id = in_actor_id;
return lv_ref_cur;
exception when others then
raise notice 'Something Went Wrong';
end;
$$

No comments:

Post a Comment