Here are my two functions,
CREATE OR REPLACE FUNCTION public.insert_stagging()
RETURNS void
LANGUAGE plpgsql
AS $function$
BEGIN
INSERT into stagging(data)
select data from mytable where data not like 'table%';
END;
$function$;
CREATE OR REPLACE FUNCTION clear_mytable2()
RETURNS TABLE(data1 text) as
$BODY$
BEGIN
RETURN QUERY (select data from mytable2);
END;
$BODY$
LANGUAGE plpgsql;
Not able to call above two functions from another function,
CREATE OR REPLACE FUNCTION func_test()
returns void as
$func$
BEGIN
EXECUTE 'SELECT insert_stagging()';
EXECUTE 'SELECT clear_mytable2()';
END
$func$ LANGUAGE plpgsql;
With the above code, I am only able to get the execution result of 1st function written inside the BEGIN clause, if I change the sequence of the 'SELECT insert_stagging()'; with 'SELECT clear_mytable2()'; then I'll only get the execution result from clear_mytable2() function.
How to execute both the function calls within 1 PostgreSQL function?