pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jasen Betts <jasen@xnet.co.nz>
To: pgsql-sql@postgresql.org
Subject: Re: Plpgsql: Iterating through a string of parameters
Date: 26 Mar 2010 08:49:02 GMT
Message-ID: <hohsdu$52m$2@reversiblemaps.ath.cx> (raw)
References: <201003251616.53097.leif@solumslekt.org>

On 2010-03-25, Leif Biberg Kristensen <leif@solumslekt.org> wrote:
> I'm struggling with how to make plpgsql iterate through a list of numbers 
> input as a text string, eg. "1438 2656 973 4208". I figure that I can use the 
> regexp_split_to_array() function to make an array of the string, but can I 
> iterate through an array with eg. a FOR loop?

using regex_split_to_table with for is easier

 for x in regex_split_to_table(....) do
 
But if you must you can use split to array and then use the array measuring
functions to determine the limit for a counted for loop.





view thread (3+ messages)

Message-ID: <hohsdu$52m$2@reversiblemaps.ath.cx>
Permalink:  ../hohsdu$52m$2@reversiblemaps.ath.cx/
Also on:    postgresql.org/message-id/hohsdu$52m$2@reversiblemaps.ath.cx

 · 

reply

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: jasen@xnet.co.nz
  Subject: Re: Plpgsql: Iterating through a string of parameters
  In-Reply-To: <hohsdu$52m$2@reversiblemaps.ath.cx>

* 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