ORACLE 不应该蹦出一个 NO_DATA_FOUND ! 太不好使用了 !

解决方案 »

  1.   

    begin
    SELECT a.class_code into economic_class_code
    FROM T_EQUIP_STANDARD a 
    where in_class_code like a.yes_include 
    and (instr( a.not_include, class_code_len3 ) = 0
    and instr( a.not_include, class_code_len4 ) = 0 ) 
    and ( a.class_level > 2 ) ;
            Return '3333-000' ;
        exception
            when no_data_found then
                Return '0000-000' ;
        end;
      

  2.   

    SQL> select * from aa;ID NAME
    -- ----------
    1  ?SQL> declare
      2  num number;
      3  begin
      4  select count(1) into num from aa;
      5  if sql%found then
      6  dbms_output.put_line('有记录');
      7  else
      8  dbms_output.put_line('没有记录');
      9  end if;
     10  end;
     11  /
    有记录