Daniel Wood <dwood@salesforce.com> writes:
> So how does one create a "WITH HOLD ref cursor for plpgsql"?
You don't --- as the previous thread mentioned, there doesn't seem
to be a lot of use-case for that, and it goes against plpgsql's
model of cursors as essentially being local variables of functions.
If you're really feeling desperate to use plpgsql to create a cursor
that will be used later by some calling application, you could probably
do EXECUTE 'DECLARE c CURSOR WITH HOLD FOR SELECT ...'. But it's not
immediately clear to me why that's better than letting the calling
application do the DECLARE for itself.
regards, tom lane