Subject Re: [firebird-support] Re: What's wrong with this SP?
Author Jorge Andrés Brugger
Martin:

Same result using your suggestion. All "stocks" belong to first
"sucursal", other are ignored (even when the 4 elements string proves
that "for select" over sucursales is working)...

Ideas are still welcome :)

martinknappe escribió:
>
> 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
> <mailto:firebird-support%40yahoogroups.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
> >
>
>

--
Jorge Andrés Brugger
Informática
DASU - Obra Social del Personal de la Universidad Nacional de la Patagonia
Comodoro Rivadavia, Chubut, Argentina
Teléfono (0297) 446-4444 int. 103
Correo electrónico: jbrugger@...
Website: www.dasu.com.ar



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