Subject | Re: [firebird-support] Re: cant declare cursor in FB 1.5 |
---|---|
Author | Helen Borrie |
Post date | 2004-03-09T22:17:44Z |
At 05:52 PM 9/03/2004 +0000, you wrote:
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
>i dont need to return a dataset, i need a CURSOR.Umm...you've got it wrong re Firebird vs "InterBase Classic". The CURSOR
>does FireBird syntax differs from Interbase classic?
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