Subject Re: [firebird-support] SP not returning a table
Author Alejandro Garcia
But the only way to show the result set as a table in InterBase 7.5 is doing a SELECT at the client side?
I'd look like a superstar if my end user runs the procedure and it outputs the result set as a table without having to run a SELECT

Helen Borrie <helebor@...> escribió:
At 03:02 AM 25/04/2007, you wrote:
>I've finished a stored procedure and I need it to return mytable
>(that I modify in the stored procedure) so I just added a SELECT *
>from mytable as the last line of the stored procedure but I'm
>getting an error:
>
> SQL error code = -104.
>Token unknown - line 74, char 22.
>;.
>
> But a table can't be an output parameter of a SP, should I
> execute the SP and then show mytable doing the SELECT outside the SP?

How much do you know about selectable stored procedures in Firebird
PSQL? Do you understand that different database engines do
procedural SQL in different ways?

In SQL you don't "output tables" at all. You output SETS. In
Firebird PSQL you can create a set inside your SP and then, on the
client side, SELECT it as though it were a table.

create procedure mytable (input1 integer, {etc.})
returns (
mt1 integer,
mt2 varchar(20),
mt3 {etc.} )
as
begin
for select field1, field2, field3 from atable
where ...
order by ...
into :mt1, :mt2, :mt3, {etc.}
do
begin
{do whatever you need to the data};
suspend;
end
end

./heLen





---------------------------------

LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com

[Non-text portions of this message have been removed]