Subject | Re: [ib-support] For Loop |
---|---|
Author | Helen Borrie |
Post date | 2001-08-28T01:18:33Z |
At 02:25 PM 27-08-01 -0500, you wrote:
rgds,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>Is there a way to do some kind of loop with Ib SQL toYes, there is - in procedures you can loop through a SELECTed set, massage the results as required and form an output set. Look up the FOR SELECT....INTO...DO...SUSPEND construct. SUSPEND holds the set in the cache until the loop is complete. That procedure can then be SELECTed to return the massaged output.
>keep querying records and adding them to a result set?
>what I want to do is, Query for some records between a certain lat and longYou can use a UNION query to return multiple congruent output sets in a single dataset. You could write a procedure that passes as arguments the ranges you want and apply each range to a separate UNIONed group or you can pull the dataset over using dynamic SQL.
>like:
>
>SELECT * FROM EXPERIAN WHERE LATITUDE BETWEEN 'xxxxxxxxx' AND 'xxxxxxxxx'
>AND
>LONGITUDE BETWEEN 'xxxxxxxxx' AND 'xxxxxxxxx'
>
>
>I I don't get enough
>
>I would like to query a second distance band and have them merged with
>the previous set ( with out having to requery first band)? may not be
>possible?
>I tested a query like this and there was no speed degredation.If that returns the results you want, it seems a plausible solution.
>
>SELECT * FROM EXPERIAN WHERE
> (LATITUDE BETWEEN 'xxxxxxxxx' AND 'xxxxxxxxx')
> OR
> (LATITUDE BETWEEN 'xxxxxxxxx' AND 'xxxxxxxxx')
> AND
> (LONGITUDE BETWEEN 'xxxxxxxxx' AND 'xxxxxxxxx'
> OR
> (LONGITUDE BETWEEN 'xxxxxxxxx' AND 'xxxxxxxxx')
rgds,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________