Subject Re: What's wrong with this SP?
Author martinknappe
Hi Jorge,
try this:

CREATE PROCEDURE SP_STOCK_SUCURSALES
returns (linea_stock varchar(200))
as
declare variable codigo_sucursal smallint;
declare variable codigo_producto integer;
declare variable stock integer;
begin
for select codigo from productos into :codigo_producto do
begin
linea_stock = '';
for select codigo from sucursales into :codigo_sucursal do
begin
select stock from stock where codigo_producto = :codigo_producto
and codigo_deposito = :codigo_sucursal into :stock;
linea_stock = rtrim(:linea_stock) || coalesce(:stock,0) || '|';
end
suspend;
end
end



Best


Martin


--- In firebird-support@yahoogroups.com, Pavel Menshchikov
<developer@...> wrote:
>
> Hello Jorge,
>
> JAB> When what I want is a line for each "producto" containing
"stock" from
> JAB> different "sucursales", not same stock for all.
> JAB> What I'm missing?
> SUSPEND in a wrong place?
>
>
> --
> Best regards,
> Pavel Menshchikov
>