Re: pl/pgsql array return

Поиск
Список
Период
Сортировка
От Barry Lind
Тема Re: pl/pgsql array return
Дата
Msg-id 3C6AA509.1000804@xythos.com
обсуждение исходный текст
Ответ на pl/pgsql array return  ("Jose Luis LG" <jlopezgonz@terra.es>)
Ответы Re: pl/pgsql array return  ("Jose Luis LG" <jlopezgonz@terra.es>)
Список pgsql-jdbc
Jose,

pl/pgsql can't return an array.  However in 7.2 it can return a cursor.
  So it is possible to do the following in jdbc:

foo() is a pl/pgsql function that returns a cursor (see pl/pgsql doc for
7.2 to see how this is done in pl/pgsql).


ResultSet l_cursorRSet = dbcon.executeQuery("select foo()");

l_cursorRSet.next();
String l_cursor = l_cursorRSet.getString(1);

ResultSet l_functionResults = dbcon.executeQuery("fetch all from " +
l_cursor);

while (l_functionResults.next()) {
   //do something useful with that data
}

//should close result sets and close the cursor when done
...


thanks,
--Barry



Jose Luis LG wrote:
> Hi,
>
>
>
> I hope someone can help me.  Is it possible to return an array of
> results from a query in a function in pl/pgsql and get this result via
> the jdbc.  Could someone send me an example of how this is done.
>
>
>
>
>
> Thanks
>
>
>
> Jose Luis
>
>
>



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

Предыдущее
От: "Nick Fankhauser"
Дата:
Сообщение: Re: problem with storing BLOBs larger then 2MB
Следующее
От: Ned Wolpert
Дата:
Сообщение: Re: Connection Pooling