Subject Re: [firebird-support] stored procedures - Part 1 SELECT
Author Helen Borrie
At 02:15 PM 22/09/2003 -0700, you wrote:

>Ok, my SPs dont handle Tranasactions, just SELECTs, INSERTs, DELETEs,
>UPDATEs.
>
>I woul like you help me with these SELECT Stored Procedures, are simple
>but I can`t retieve the results to my aplication.
>
>I wan to retrive the rows of these selects, not by return parameters, that
>are I retrieve in this moment.

Firebird has "selectable stored procedures" for returning multiple-row
sets. But you still have to define the output in a "returns" clause.


>sqlserver:
>
>-----------------------------------------------------------------------
>
>CREATE PROCEDURE pa_Pais_Consultar
>AS
> SELECT * FROM Paises
>
>GO

CREATE PROCEDURE pa_Pais_Consultar
returns (output1, output2....whole column list)
as
begin
for select col1, col2...whole column list
from Paises
into :output1, :output2......etc. DO
SUSPEND;
end


>-----------------------------------------------------------------------
>
>And this one (sqlserver):
>
>-----------------------------------------------------------------------
>
>CREATE PROCEDURE pa_Pais_Consultar
> @Id INTEGER
>AS
> SELECT * FROM Paises WHERE [Id] = @Id
>GO
>
>------------------------------------------------------------------------

CREATE PROCEDURE pa_Pais_Consultar3
(Id INTEGER)
returns (output1, output2....whole column list)
as
begin
for select col1, col2...whole column list
from Paises
where Id = :Id
into :output1, :output2......etc. DO
SUSPEND;
end

>I Call thes SPs in this way:
>
>EXEC pa_Pais_Consultar
>
>And
>
>EXEC pa_Pais_Consultar 3

Firebird calls them like this:

select * from pa_Pais_Consultar
and
select * from pa_Pais_Consultar3 (constant_value)

I'm curious why you need SPs to get these sets.

There is a documentation about writing SPs. Get the IB 6 beta doc Language
Reference (langref.pdf) from the www.ibphoenix.com site, at Downloads >
InterBase.

heLen