Обсуждение: Calling a stored procedure with an array parameter

Поиск
Список
Период
Сортировка

Calling a stored procedure with an array parameter

От
Andrei Gheorghe
Дата:
Hello

I would like to know if I can use the postgres ODBC driver to call a stored procedure with an array parameter. I've managed to do it by binding the parameter as SQL_CHAR with a value like { value1, value 2 }but I would like to know if there's another more efficient way.

Re: Calling a stored procedure with an array parameter

От
Heikki Linnakangas
Дата:
On 13.08.2013 11:32, Andrei Gheorghe wrote:
> Hello
>
> I would like to know if I can use the postgres ODBC driver to call a stored procedure with an array parameter. I've
managedto do it by binding the parameter as SQL_CHAR with a value like { value1, value 2 }but I would like to know if
there'sanother more efficient way. 

There's no straightforward way to create an array value in the client
and send it as a query parameter. You could call it with something this
though:

SELECT my_stored_procedure(ARRAY[?,?,?,?]);

Fill in the parameters with the individual values, and the server will
construct the array from them.

- Heikki


Re: Calling a stored procedure with an array parameter

От
Andrei Gheorghe
Дата:
Thank you. It works.