Re: Errors using JDBC batchUpdate with plpgsql function

Поиск
Список
Период
Сортировка
От Nanker Phelge
Тема Re: Errors using JDBC batchUpdate with plpgsql function
Дата
Msg-id CAF20xuFu=5+DYe_CTXFAny0_YGNJ5+1mb+P2fD=wnCTDBymEaQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Errors using JDBC batchUpdate with plpgsql function  (Thomas Kellerer <spam_eater@gmx.net>)
Ответы Re: Errors using JDBC batchUpdate with plpgsql function
Список pgsql-general
The database function does not use out parameters or a ref cursor, which was why I was confused.  The Java sample I provided is a simplification of the built-in default logic of the Spring Batch ItemWriter - I put it into my own implementation class to help with debugging. The root cause seems to be the JDBC driver thinking that there should not be results because it is an update and the 'select' influencing that decision.  I tried switching this ItemWriter implementation to use a CallableStatement, and that did work, but I wanted to understand why the approach I listed in the original post didn't work.

Thanks


On Mon, May 4, 2015 at 6:05 AM, Thomas Kellerer <spam_eater@gmx.net> wrote:
Hannes Erven schrieb am 04.05.2015 um 12:31:
> Hi,
>
>
>>          String sql = "select test_user_result_insert_func(?, ?, ?);";
>
> You can't call functions via JDBC like that.

That's perfectly valid - unless the function uses out parameters or ref cursors.

I am however unsure about batched statements here. So trying CallableStatement is definitely worth a shot.




--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

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

Предыдущее
От: Yves Dorfsman
Дата:
Сообщение: Re: plpgsql functions organisation
Следующее
От: mark
Дата:
Сообщение: Re: [HACKERS] Insert result does not match record count