Ver Mensaje Individual
  #4  
Antiguo 07-07-2012
Gallosuarez Gallosuarez is offline
Miembro
 
Registrado: feb 2007
Posts: 92
Reputación: 18
Gallosuarez Va por buen camino
Talking Posible error ...

A primera vista, creo que hay un error de lógica .... le hace falta el begin/end, sino la única instrucción que se ejecuta dentro del bucle for es el primer if.
Saludos

P.D. por mi parte también creo que el suspend no es necesario (depente realmente de lo que quieras que haga tu aplicación)

Código SQL [-]
CREATE PROCEDURE SP_ACTUSTOCK_FCV_SUMA(
  IDFACVTA INTEGER)
AS
DECLARE VARIABLE CODART VARCHAR(15);
DECLARE VARIABLE CANTID NUMERIC(18, 2);
DECLARE VARIABLE STOCK VARCHAR(1);
BEGIN 
  /* Procedure body */ 
  for select stock,codart,cantid
      from DETFAC 
      where idfacvta = :idfacvta 
        into :Stock, :Codart, :Cantid do
        begin 
          if stock = '1' then
          update ARTICULO set cantid = cantid + :cantid where codart = :codart;
          if stock = '2' then  
          update ARTICULO set canti2 = canti2 + :cantid where codart = :codart;
          SUSPEND;
        end 
END^

Última edición por Gallosuarez fecha: 07-07-2012 a las 15:22:38. Razón: corregir código ...
Responder Con Cita