-- FUNCTION: public.asyncmultiplerecs()
-- DROP FUNCTION public.asyncmultiplerecs();
CREATE OR REPLACE FUNCTION public.asyncmultiplerecs()
RETURNS SETOF refcursor
LANGUAGE 'plpgsql'
COST 100.0
AS $function$
DECLARE
ref1 refcursor; -- Declare cursor variables
ref2 refcursor;
ref3 refcursor;
ref4 refcursor;
BEGIN
OPEN ref1 FOR SELECT bk_channel_id,promotion_id FROM cs_promotion_offer_exclusions;
RETURN NEXT ref1;
OPEN ref2 FOR SELECT mastergroup,promo_grp_id FROM cs_promotion_group_master;
RETURN NEXT ref2;
OPEN ref3 FOR SELECT promotion_usoc,promotion_duration FROM cs_promotion_target_details;
RETURN NEXT ref2;
OPEN ref4 FOR SELECT promotion_id,offer_id FROM cs_promotion_details;
RETURN NEXT ref4;
END;
$function$;
Above is my Function, i want to execute all the records sets from the above function.