Ver Mensaje Individual
  #2  
Antiguo 21-03-2005
Avatar de StartKill
StartKill StartKill is offline
Miembro
 
Registrado: ene 2004
Posts: 299
Reputación: 21
StartKill Va por buen camino
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ú
Responder Con Cita