I have created a stored procedure using PGADMIN4. Inside the SP, I have selected a view table. However, I want the data inside the stored procedure to be inserted into a new table. I have tried below code, but it is showing an error:
SP name: Test
New table name: Customer
Insert into public.Customer exec public.Test
This is my SP code:
create procedure test()
language plpgsql
as $$
BEGIN
Select * from public.customer_list;
END;
$$;
ERROR: syntax error at or near "exec"
RETURN, see here SP return 3) A SP needs to be used with CALLRETURN QUERY, see here Returning 43.6.1.2. RETURN NEXT and RETURN QUERY and look at examples. Then something likeInsert into public.Customer select * from public.test();.