fetch num_p into in_num;
EXIT WHEN num_p%NOTFOUND;
if in_num='007' then
    null;
else
    select clcnum from cusidt where norigt=in_num;
end if;
end loop;

解决方案 »

  1.   

    open num_p;
    loop
      <<top>>
      fetch num_p into in_num;
      EXIT WHEN num_p%NOTFOUND;
      if in_num='007' then
        goto top;
      end if;
      
      select clcnum from cusidt where norigt=in_num; //这句有问题,需要有into
    end loop;
      

  2.   

    fetch num_p into in_num;
    EXIT WHEN num_p%NOTFOUND;
    if in_num='007' then
        null;
    else
        exec immediate 'select clcnum from cusidt where norigt='||in_num;
    end if;
    end loop;