DEFINITIONS

Definitions More Info.
Definition ID12.072
TitlePOSTGRESQL
CategoryNOTES
DefinitionCURSOR FETCH EXAMPLE
Definition DescriptionDO $$
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 $$;
RecordBycunay
Record Date19-05-2022 22:41:52
Düzenle
Kopyala
Sil