[postgis-users] Loop or Cursor

Paragon Corporation lr at pcorp.us
Mon Jul 20 19:45:15 PDT 2009


What kind of operation?  Even an update statement might suffice.  There are
many ways to cleverly control the flow of an update that do not necessitate
doing a loop or cursor.
 
Also keep in mind even within a function used in a  SELECT statement of a
query, PostgreSQL allows you to run updates and do all sorts of crazy things
like launch perl scripts and bash scripts.  So for example you can mail to
your whole membership simple by doing this
 
SELECT member_name, send_mail(member_id) As did_it_send
FROM membership
WHERE gross_income > 1000000 and active = true
 
 
It is very convenient for making rule processors.
 
Leo
 

  _____  

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Bob
Pawley
Sent: Monday, July 20, 2009 1:43 PM
To: PostGIS Users Discussion
Subject: [postgis-users] Loop or Cursor


Hi
 
I need to access a number of rows, one at a time to perform an operation on
each.
 
Under what conditions would I consider using a loop command, rather than (or
with) a cursor?
 
Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090720/7790f6e3/attachment.html>


More information about the postgis-users mailing list