Can Postgres 13 stored procedures return multiple result sets similar to SQL Server?

1.2k views Asked by At

I tried to search for it in the official docs but no luck. Can Postgres 13 stored procedures return multiple result sets similar to SQL Server?

1

There are 1 answers

5
maksymsan On BEST ANSWER

If you mean to return a result set by executing a plain query - no, such syntax is not supported in PL/pgSQL.

If you mean to return a result set by using a cursor - yes, PostgreSQL stored procedures can return cursors too.

You can define multiple cursor output parameters: https://www.postgresql.org/docs/13/plpgsql-cursors.html