CREATEOR REPLACEFUNCTION show_cities_multiple() RETURNSSETOFrefcursorAS $$ DECLARE ref1 refcursor; -- Declare cursor variables ref2 refcursor; BEGIN OPEN ref1 FORSELECT1; -- Open the first cursor RETURN NEXT ref1; -- Return the cursor to the caller
OPEN ref2 FORSELECT2; -- Open the second cursor RETURN NEXT ref2; -- Return the cursor to the caller END; $$LANGUAGE plpgsql;