[postgis-users] writing loop and conditionals in pl/pgsql

Basques, Bob (CI-StPaul) bob.basques at ci.stpaul.mn.us
Wed Mar 5 09:05:50 PST 2014

                tab1, tab2
                tab1.hk_id = tab2.hk_id  -- Assuming you have a ID column in both tables . . .
                tab2.y_max < tab1.h_max
                tab2.y_max > tab1.h_min
order by


From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of mane moshref
Sent: Wednesday, March 05, 2014 10:38 AM
To: postgis-users at lists.osgeo.org
Subject: [postgis-users] writing loop and conditionals in pl/pgsql

Hi all,
I am quite new to pl/pgsql and completely confused.
I have two tables. One storing height category including hk_id(height category id), h_min and h_max. and a table including several plygons having y_max and height. My aim is to know on which height category the plygon locates based on its y_max.
My piece of code is like:
i=1; a=0;
while (i=<4 , a=0){
if h(i)_min < y_max < h(i)_max
{height = i
a = 1;}
i = i + 1
Is there any body who can help me to convert this piece of code to excutable format in pl/pgsql?
Thank you in advance

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140305/34915d26/attachment.html>

More information about the postgis-users mailing list