Re: refcursor returned by pl/psql to jdbc

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: refcursor returned by pl/psql to jdbc
Дата
Msg-id 1018535384.1501.72.camel@inspiron.cramers
обсуждение исходный текст
Ответ на refcursor returned by pl/psql to jdbc  (Richard Emberson <emberson@phc.net>)
Ответы Re: refcursor returned by pl/psql to jdbc  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-jdbc
Richard,

The problem is that the cursor is un-named. Is there a way to name the
cursor? jdbc doesn't know what to do with a column named <unnamed cursor
1>

Dave
On Wed, 2002-04-10 at 19:03, Richard Emberson wrote:
> Ok, I wanted to wrap a select statement with a PL/pgsql procedure
> (information hiding, etc.)
> So I have:
>
> CREATE OR REPLACE FUNCTION user_data_select_all(BIGINT)
> RETURNS REFCURSOR AS '
> DECLARE
>     -- parameters
>     owner_id_p ALIAS FOR $1;
>
>     -- local variables
>     rc REFCURSOR;
> BEGIN
>     OPEN rc FOR SELECT *
>         FROM user_data
>         WHERE
>             owner_id = owner_id_p;
>     RETURN rc;
> END;
> ' LANGUAGE 'plpgsql' WITH (isstrict);
>
> Now from within psql I get the following:
>
> => select user_data_select_all(12);
>  user_data_select_all
> ----------------------
>  <unnamed cursor 15>
> (1 row)
>
> I kind of expected to see the actual rows?!?
>
> and from JDBC I get an exception:
> Bad Long <unnamed cursor 1>
>         at org.postgresql.jdbc2.ResultSet.toLong(ResultSet.java:1498)
>         at org.postgresql.jdbc2.ResultSet.getLong(ResultSet.java:257)
>
> So the question is can I wrap a select function as return a resultset to
>
> JDBC?
> Richard
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
>




В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "Dennis R. Gesker"
Дата:
Сообщение: Re: taglib help
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: refcursor returned by pl/psql to jdbc