<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div>Hi all,</div><div> </div><div>I am quite new to pl/pgsql and completely confused. </div><div>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.</div><div>My piece of code is like:</div><div> </div><div>i=1; a=0;</div><div>while (i=<4 , a=0){</div><div>        if h(i)_min < y_max < h(i)_max</div><div>             {height = i</div><div>             a = 1;}</div><div>        i = i + 1</div><div>        }</div><div> </div><div>Is there any body who can help me to convert this piece of code to excutable format in pl/pgsql?</div><div> </div><div>Thank you in
 advance</div><div>Many</div><div> </div><div><br clear="all"></div></div></body></html>