X-Original-To: pgsql-novice@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8CC25475C14; Thu, 13 Feb 2003 23:16:46 -0500 (EST) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id 8F5FC475F73; Thu, 13 Feb 2003 23:14:36 -0500 (EST) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2839316; Thu, 13 Feb 2003 20:14:48 -0800 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: Michael Weaver , "'pgsql-novice@postgresql.org'" , "'pgsql-sql@postgresql.org'" Subject: Re: [SQL] Passing arrays Date: Thu, 13 Feb 2003 20:14:15 -0800 User-Agent: KMail/1.4.3 References: <3B663B41B350D311AEEF00A0C9254563201A70@VISION1> In-Reply-To: <3B663B41B350D311AEEF00A0C9254563201A70@VISION1> MIME-Version: 1.0 Message-Id: <200302132014.15805.josh@agliodbs.com> Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/169 X-Sequence-Number: 6185 Micheal, > How do you get an array of elements to be passed to a stored proc such th= at > 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= =20 variable. 2) Build up your query as a dynamic string. 3) Do your query loop as a FOR record IN EXECUTE dynamic_query_string --=20 Josh Berkus Aglio Database Solutions San Francisco