PAGUE 6 MESES
LEVE 12 MESES
GARANTIR DESCONTO

Fórum multiple rows in singleton select At trigger #515176

30/03/2015

0

Bom dia , estou tendo um problema com um sistema que estou migrando o banco de dados de firebird 2.1 para 2.5(não sei se isso tem algo a ver), mas a trigger abaixo funcionava tranquilamente no firebird 2.1 e agora está dados o erro citado no titulo.

Agradeço qualquer ajuda.

Alexandre Torres


as
 DECLARE VARIABLE TIPO CHAR(1) CHARACTER SET WIN1252;
begin

 UPDATE PRODUTOS SET QTD = 0
 WHERE QTD IS NULL;

select p.tipo from produtos p
inner join movimento_itens M on p.cod_prod = m.cod_prod
 INTO :TIPO;

 if (:TIPO = 'P') then
  begin
   if (tipo = '-') then
    UPDATE PRODUTOS P2 set p2.qtd = p2.qtd + (select MOVIMENTO_ITENS.qtd
    from movimento_itens
     where p2.cod_prod = MOVIMENTO_ITENS.cod_prod);
   ELSE
   if (tipo = '+') then
    UPDATE PRODUTOS P2 set p2.qtd = p2.qtd - (select MOVIMENTO_ITENS.qtd
    from movimento_itens
     where p2.cod_prod = MOVIMENTO_ITENS.cod_prod);
  end
end
Alexandre Torres

Alexandre Torres

Responder

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar