Subject Re: What's wrong with this SP?
Author lobolo2000
> What I'm missing?

The line: stock = 0;

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
stock = 0;
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

HTH