Skip site navigation (1) Skip section navigation (2)

Re: How to fetch the RefCursor in via ODBC??

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Harry Yau <harry(at)aurasound(dot)com(dot)hk>
Cc: Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to fetch the RefCursor in via ODBC??
Date: 2003-06-30 14:04:43
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Harry Yau <harry(at)aurasound(dot)com(dot)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

In response to

pgsql-general by date

Next:From: Tom LaneDate: 2003-06-30 14:22:46
Subject: Re: MemoryContextAlloc: invalid request size
Previous:From: Andrew GouldDate: 2003-06-30 13:39:30
Subject: Re: Cannot create unique index

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group