Subject Re: [firebird-support] How to iterate through the records
Author Helen Borrie
At 09:02 AM 3/03/2005 -0300, you wrote:

>Hello:
>I would like know if exists a manner of iterate through the records
>inside a stored procedure. For instance:
>I created a sp with following statement:

>SELECT DATE_INI FROM SALE WHERE DATE_INI = :VDATE;

>Well, I need, next, retrieve the record prior to the record retrieve for
>the select clause above.
>How to do it?

I don't think you mean "iterate".

This will do it:

SELECT FIRST 1 DATE_INI FROM SALE
WHERE DATE_INI < :DATE_INI
ORDER BY 1 DESC

You don't need a SP to do this.

If you want to iterate through a set in a SP, that is something else. Ask
again with a suitable pseudocode example.

./hb