Subject Re: [firebird-support] cursor in a Firebird StoredProc
Author Martijn Tonies
Hi,

> I always use cursors in MSSQL.
> an example:
> --------------------------------------------------------------------
> Declare curMedicos Cursor local Fast_Forward for
> Select Codigo, Nombre, idMedicoSolicitante
> >From Maestro_Medicos mm
> Inner Join Especialidad_Medico em On em.Medico = mm.Codigo
> Where Not mm.idMedicoSolicitante is Null
>
> Open CurMedicos
> Fetch From CurMedicos Into @idMedico, @NombreMedico, @idMedsol
> While @@Fetch_status = 0
> Begin
> "do something with the cursor"
> Fetch From CurMedicos Into @idMedico, @NombreMedico, @idMedsol
> End
> Close CurMedicos
> Deallocate CurMedicos
> ---------------------------------------------------------------
>
> Can somebody send me an example of the use of cursors in Firebird ?

FOR SELECT Codigo, Nombre, idMedicoSolicitante
> >From Maestro_Medicos mm
> Inner Join Especialidad_Medico em On em.Medico = mm.Codigo
> Where Not mm.idMedicoSolicitante is Null
INTO :variable1, :variable2
DO BEGIN
... something with data ...
END

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com