Thread: Calling a stored procedure with an array parameter

Calling a stored procedure with an array parameter

From
Andrei Gheorghe
Date:
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

From
Heikki Linnakangas
Date:
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

From
Andrei Gheorghe
Date:
Thank you. It works.