I am new to postgresql. I am trying to load query output into a temp table and wanted to use that temp table further in the stored procedure. But it is not allowing to save the following script.
Kindly share some pointers. I am unable to get any reference from internet/google
It throws an error: ERROR: relation "newtemptable" does not exist LINE 7: select * from newtemptable ^
CREATE OR REPLACE PROCEDURE sp_getworkflow()
LANGUAGE 'sql'
AS $BODY$
CREATE TEMP TABLE newtemptable AS
select "TXNID", "FILENAME" from "oldtable" where "TXNID" = 'abc';
SELECT * FROM "newtemptable";
$BODY$;