比方说句子select a from tab_x
我想在句子有记录返回的时候执行  select b from tab_y
无记录的时候    select c from tab_z
其他错误的时候报错
怎么写句子简洁点呢
一大串if then esle  太无聊了

解决方案 »

  1.   

    begin 
      begin 
        select ......
      exception 
        when no_data_found then  --找不数据的判断
          select ...
      end;
    exception 
      when  others then 
        raise ;
    end;
    /
      

  2.   

    begin 
      begin 
        select ......
      exception 
        when no_data_found then  --找不数据的判断
          select ...
      end;exception 
      when  others then 
        raise ;
    end;
      

  3.   

    begin 
      begin 
        select ......
      exception 
        when no_data_found then  --找不数据的判断
          select ...
      end;
     select ...  ----这里no_data_found的时候时候不要执行的exception 
      when  others then 
        raise ;
    end;
      

  4.   

    case when----使用游标属性---
      

  5.   

    ASP.NET专家讨论群:30417196,限工作人士