Subject RE: [firebird-support] DECLARE MyCursor CURSOR
Author Helen Borrie
At 05:15 PM 7/10/2004 +0200, you wrote:

> > Thanks for your answer, but to which question are you answering?
> >
> > Can one DECLARE, OPEN, FETCH, and CLOSE a CURSOR in one stored procedure?
> > If so, how? Using IBExpert, I can't seem to DECLARE a CURSOR, much less
> > OPEN, FETCH, and CLOSE it?
> >
> > In Helen Borrie's book, she keeps saying that CURSORs are beyond the scope
> > of her book. Are CURSORs beyond the scope of Firebird too?
>Robert, if you don't own the InterBase 6 Beta documentation set
>or one of the manuals available on the IBPhoenix CD, then get
>in touch with Firebird Stored Procedure and Triggers here:

Umm, if he has the Firebird Book, it's hardly worth the trouble. TFB has a
complete Part (5 chapters) devoted to them.

The extent to which it is possible to use cursor sets in PSQL is fully
covered there - including the (otherwise) undocumented use of a named
cursor in a FOR..SELECT...FOR UPDATE INTO <vars> AS CURSOR <Cursorname>
statement. :-) (Sorry, Carlos, but there **is** more than one way to zap
through a select set in a SP).

All that DECLARE CURSOR, SET CURSOR and so on stuff is available in
embedded SQL, a branch of Firebird that isn't covered in TFB.

I believe named cursors with real guts are coming in Firebird 2, though I
don't have any details yet about syntax or usage. It would be nice if one
could pass a cursor as a parameter in an embedded procedure call, or return
one in RETURNING_VALUES, but this is wishful thinking on my part at the moment.