Wnas,
Revisale esta lineas y ajustale a tu necesidad:
Código SQL
[-]CREATE PROCEDURE AA01
AS
DECLARE VARIABLE XCODIGO CHAR(3);
DECLARE VARIABLE XNUMBER INTEGER;
begin
for select fcodigo, fnumber from aa1 into :xcodigo, :xnumber do begin
insert into aa2 (fcodigo, fnumber) values (:XCODIGO, :xnumber);
end
suspend;
end
Código SQL
[-]CREATE PROCEDURE AA02
AS
DECLARE VARIABLE XCODIGO CHAR(3);
DECLARE VARIABLE XCOD2 CHAR(3);
DECLARE VARIABLE XNUMBER INTEGER;
begin
for select fcodigo, fnumber from aa1 into :xcodigo, :xnumber do begin
select fcodigo from aa2 where fcodigo=:xcodigo into :xcod2;
if (:xcod2 <>:xcodigo) then
insert into aa2 (fcodigo, fnumber) values (:XCODIGO, :xnumber);
else
update aa2 set fnumber=:xnumber where fcodigo=:xcodigo;
end
suspend;
end
Your friend,
StartKill
Lima-Perú