Reputation: 804
I am trying to write an SQL Server stored procedure in PostgreSQL.
One of the statement is, INSERT INTO @TempTable EXEC(@DynamicQuery)
In SQL Server, @DynamicQuery
executes and inserts result into @TempTable table variable. I am not finding similar option in PostgreSQL. Can somebody help with any hint please. Thanks.
Upvotes: 3
Views: 4891
Reputation: 246483
Your PL/pgSQL line would look similar to the following:
EXECUTE 'CREATE TEMPORARY TABLE mytemp AS ' || dynamicquery;
Upvotes: 7