Re: returning refcursors (into Visual Basic)

From: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
To: Erik Hjortsberg <Erik_Hjortsberg(at)hermes(dot)ics(dot)lu(dot)se>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: returning refcursors (into Visual Basic)
Date: 2002-03-04 23:44:33
Message-ID: 3C8406E1.520B8919@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Erik Hjortsberg wrote:
>
> Hello.
>
> I'm having some serious difficulties with making a function returning a
> recordset in the form of a refcursor to Visual Basic through pgODBC (or
> through pgAdminII).
> I'm using postgreSQL 7.2 and pgODBC 7.1.9
> I've tried with a function such as
>
> CREATE FUNCTION "returnCourse"("bpchar") RETURNS "refcursor" AS
> 'declare
> _course ALIAS FOR $1;
> _refcursor refcursor;
> begin
> OPEN _refcursor FOR SELECT * FROM course where code = _course;
> return _refcursor;
> end;
>
> ' LANGUAGE 'plpgsql';
>
> But the only thing I get is a single value recordset with the string
> "<unnamed cursor 1>".
> Does anybody know what I'm doing wrong?

What your function returns is a reference to (name of)
a cursor and unfortunately there are few applications
which recognize "refcursor" and you have to call FETCH
commands using the cursor name to get the result.

regards,
Hiroshi Inoue

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Wolfgang.Fuertbauer 2002-03-05 08:10:42 Problem with VB-DirectODBC selecting text-fields [EBEWE: Virus checked]
Previous Message Dave Page 2002-03-04 19:41:01 Re: Basic ODBC/PostgreSQL