DO $$ BEGIN DECLARE film_id integer; DECLARE title varchar(55); DECLARE cur_update CURSOR FOR SELECT "film"."film_id","film"."title" FROM public."film" LIMIT 5; -- Fetch the first 5 rows in the cursor liahona: BEGIN -- open the cursor OPEN cur_update;
LOOP -- fetch row into the film FETCH cur_update INTO film_id,title; -- exit when no more row to fetch EXIT WHEN NOT FOUND; RAISE NOTICE 'Value: % hede %', film_id, title; END LOOP; CLOSE cur_update; END; END $$;