Re: How to fetch the RefCursor in via ODBC?? - Mailing list pgsql-general

From Tom Lane
Subject Re: How to fetch the RefCursor in via ODBC??
Date
Msg-id 4380.1056981883@sss.pgh.pa.us
Whole thread Raw
In response to How to fetch the RefCursor in via ODBC??  (Harry Yau <harry@aurasound.com.hk>)
List pgsql-general
Harry Yau <harry@aurasound.com.hk> writes:
>   I wrote a function to return a RefCursor of a temp table as below:

>     CREATE FUNCTION reffunc(refcursor, varchar(10), varchar(10))
>         RETURNS refcursor AS '
>         BEGIN
>           EXECUTE ''create local temp table tablexxx
>                     (repno character(15), date date)'';
>           insert into tablexxx (repno, date) VALUES ( $2, now() );
>           insert into tablexxx (repno, date) VALUES ( $3, now() );
>           OPEN $1 for EXECUTE '' SELECT * FROM tablexxx '';
>           RETURN $1;
>           EXECUTE '''';
>         END;
>     ' LANGUAGE 'plpgsql';

I think you probably need the INSERTS to be done via EXECUTE as well,
at least if you want this to work more than once per session.

Not sure about your ODBC issue, but pgsql-odbc would be the place to
ask about that.

            regards, tom lane

pgsql-general by date:

Previous
From: Andrew Gould
Date:
Subject: Re: Cannot create unique index
Next
From: Tom Lane
Date:
Subject: Re: MemoryContextAlloc: invalid request size