Re: Passing arrays - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Passing arrays
Date
Msg-id 200302132014.15805.josh@agliodbs.com
Whole thread Raw
In response to Passing arrays  (Michael Weaver <mweaver@corpusglobe.com>)
List pgsql-sql
Micheal,

> How do you get an array of elements to be passed to a stored proc such that
> you can use the array in a SELECT statement in the WHERE clause
>  - e.g.  WHERE field IN (array) etc...

There's no easy way, right now.  You'll have to:
1) loop through the array and pass its elements to a comma-delimited TEXT
variable.
2) Build up your query as a dynamic string.
3) Do your query loop as a FOR record IN EXECUTE dynamic_query_string

--
Josh Berkus
Aglio Database Solutions
San Francisco

pgsql-sql by date:

Previous
From: Michael Weaver
Date:
Subject: Passing arrays
Next
From: chester c young
Date:
Subject: rownum