Ver Mensaje Individual
  #13  
Antiguo 24-02-2011
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.044
Reputación: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Prueba esto:

Código SQL [-]
CREATE OR ALTER PROCEDURE NEW_PROCEDURE2 (in_random decimal(12,0))
returns (out_random decimal(12,0))
as
  declare variable aux_rand decimal(12,0);
  declare variable aux_true integer;
begin
  AUX_TRUE  = 0;
 
  while (:AUX_TRUE = 0) do
  begin

    aux_rand = null;   /*   <------------------------------- */

    Select RANDOMNO from PRUEBA
      where RANDOMNO = :IN_RANDOM
      rows 1 into AUX_RAND;

    if (:AUX_RAND is null) then
    begin
      Leave;
    end
    else
    begin
      IN_RANDOM = :IN_RANDOM + 1;
      if (:IN_RANDOM > 200) then
        Leave;
    end

  end
 
  OUT_RANDOM = IN_RANDOM;
 
  suspend;
 
end
Responder Con Cita