From: Josh Berkus <josh@agliodbs.com>
To: Michael Weaver <mweaver@corpusglobe.com>
To: 'pgsql-novice@postgresql.org' <pgsql-novice@postgresql.org>
To: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: [SQL] Passing arrays
Date: Thu, 13 Feb 2003 20:14:15 -0800
Message-ID: <200302132014.15805.josh@agliodbs.com> (raw)
In-Reply-To: <3B663B41B350D311AEEF00A0C9254563201A70@VISION1>
References: <3B663B41B350D311AEEF00A0C9254563201A70@VISION1>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com, mweaver@corpusglobe.com, pgsql-novice@postgresql.org
Subject: Re: [SQL] Passing arrays
In-Reply-To: <200302132014.15805.josh@agliodbs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox