判断一个查询是否查到结果,
如果查到结果进行一个操作  
没有查到结果 进行其他操作。 
怎样判断是否查到结果,
查询 下面就要接着这个判断  怎么实现?

解决方案 »

  1.   

    你指的是这样?
    declare
    v_temp varchar2(30);
    begin
      select col1 into v_temp from table where condition..;
      dbms_output.put_line('find the result');
      exception 
      when no_data_found then
      dbms_output.put_line('that is no data');
    end;
      

  2.   

    declare
    v_temp varchar2(30);
    begin
      select max(col1) into v_temp from table where condition..;
      if v_temp is null then 
      begin
       -----你要做什么
      end;
      else 
      begin
      ---你要做什么
      end ;
      end if;
    end;