Subject Re: [firebird-support] Re: cant declare cursor in FB 1.5
Author Helen Borrie
At 05:52 PM 9/03/2004 +0000, you wrote:
>i dont need to return a dataset, i need a CURSOR.
>does FireBird syntax differs from Interbase classic?

Umm...you've got it wrong re Firebird vs "InterBase Classic". The CURSOR
syntax is fully implemented in Embedded SQL, which was InterBase's original
programming interface.

You can bring a cursor into an executable SP using the FOR...SELECT...INTO
syntax, massage data and pass update, insert or delete statements to the
table (no SUSPEND).

Regular cursor syntax *is* available in SPs, currently as the example
below. However, Dmitry Y. has completely reimplemented the syntax for
Firebird 2, so your SPs would almost certainly need work later, if you
upgraded the server.

Here is the syntax as it stands for Fb 1.0 and 1.5:

<declare variables>
<Note, cursor is not pre-declared>
BEGIN
FOR
SELECT ACOL, BCOL, ........
FROM ATABLE
FOR UPDATE
INTO :ACOL, :BCOL
AS CURSOR MyCursor
DO
BEGIN
UPDATE ATABLE SET ...
WHERE CURRENT OF MyCursor;
...
END
END

/heLen