LOOP Functions - where to start?

From: James David Smith <james(dot)david(dot)smith(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: LOOP Functions - where to start?
Date: 2012-07-30 16:11:59
Message-ID: CAMu32ABD7zr=DukO8LFf3bppd8GhjgSXqE8_Hp4-v267fMmRrw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi all,

Thanks for the help a week or two ago with matching the time fields. I
managed to move on from that issue at last which was pleasing. I'm now
struggling with LOOP functions though. I've been having a look around the
net for some gentle introductions to them but haven't found any good ones
yet - could someone point me towards them if they exist? I don't like the
ones in the manual much.

Once I've learnt how loops work, I want to try and do something like the
below (simplified). Wrote in pseudo-code for now as I'm not sure how of the
format to write it properly and get it working. Essentially I want to split
a line into a number of equally defined and evenly spaced points. I
discovered the st_line_interpolate_point function, but I need to put that
inside a loop and store each record that it generates into a new table.
_____________
j = 0.2
i = 0.2
WHILE i < '1'
LOOP
SELECT ST_Line_Interpolate_Point(line, j)
INTO new_record_in_new_table
j = i+j
END LOOP
____________

Thanks for the communitys help as always.

James

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Merlin Moncure 2012-07-30 16:29:37 Re: LOOP Functions - where to start?
Previous Message Tom Lane 2012-07-30 14:27:46 Re: 8.4.12 log truncation not working?