Error a la hora de generar un trigger
Trabajo con interbase 5, realizo la siguiente instruccion:
CREATE TRIGGER ACTPEDIDO1 FOR PZALB ACTIVE
AFTER INSERT POSITION 0
as
declare variable n int;
declare variable nPedido int;
begin
select Pedido
from Albaran
where N_Alb=new.N_Alb
into :nPedido;
select Realzdas from pzpedido
where (PzPedido.O_Ped = new.O_Ped) AND
(PzPedido.Pedido = :nPedido)
into :n;
if (n is null) then
n = 0;
if (not new.QA is null) then
n = n + new.QA;
update PzPedido set Realzdas = :n
where (PzPedido.O_Ped = new.O_Ped) AND
(PzPedido.Pedido = :nPedido);
end
Meda el error : XSQLDA index out of range.
¿Como lo soluciono?
|