On 1 November 2017 at 05:08, Peter Eisentraut <peter.eisentr...@2ndquadrant.com> wrote:
> CREATE PROCEDURE pdrstest1() > LANGUAGE SQL > AS $$ > DECLARE c1 CURSOR WITH RETURN FOR SELECT * FROM cp_test2; > DECLARE c2 CURSOR WITH RETURN FOR SELECT * FROM cp_test3; > $$; > > CALL pdrstest1(); FWIW, this is similar to the model already used by PgJDBC to emulate multiple result sets, though the current support in the driver is rather crude. It detects a REFCURSOR in an output parameter / result set and transparently FETCHes the result set, making it look to the client app like it's a nested result set. This shouldn't conflict with what you're doing because the driver does not follow the JDBC standard behaviour of using Statement.getMoreResults() and Statement.getResultSet() for multiple result sets. That's currently only used by PgJDBC when fetching result sets from batch query executions. Instead, the multiple result set emulation requires the caller to 'getObject' the 'refcursor' field's result-object, then cast it to ResultSet, and treat it as a new (nested) result set. True multiple result sets would be exposed in PgJDBC via getMoreResults(). -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers