Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id D2F0C6324E0 for ; Fri, 26 Mar 2010 05:49:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 76691-07 for ; Fri, 26 Mar 2010 08:49:07 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ananke.wxnz.net (ananke.wxnz.net [58.28.4.122]) by mail.postgresql.org (Postfix) with ESMTP id E2E7C6323CE for ; Fri, 26 Mar 2010 05:49:11 -0300 (ADT) Received: from gonzo (ip-118-90-129-231.xdsl.xnet.co.nz [118.90.129.231]) by ananke.wxnz.net (Postfix) with ESMTP id D0B5F170784 for ; Fri, 26 Mar 2010 21:49:08 +1300 (NZDT) Received: from news by gonzo with local (Exim 4.69) (envelope-from ) id 1Nv5Dy-0001PZ-GE for pgsql-sql@postgresql.org; Fri, 26 Mar 2010 21:49:02 +1300 To: pgsql-sql@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.sql Subject: Re: Plpgsql: Iterating through a string of parameters Date: 26 Mar 2010 08:49:02 GMT Organization: Dis (not Dat) Organisation Lines: 14 Message-ID: References: <201003251616.53097.leif@solumslekt.org> NNTP-Posting-Host: localhost Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: reversiblemaps.ath.cx 1269593342 5206 127.0.0.1 (26 Mar 2010 08:49:02 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-2 (Linux) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.29 tagged_above=-10 required=5 tests=AWL=-0.291, BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 201003/203 X-Sequence-Number: 33910 On 2010-03-25, Leif Biberg Kristensen 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.