select 到的纪录数目不等于1就会异常
你在sqlplus里面执行select health_content into out_content from dw_health_content where sequence_no=2;
看看结果集有几条

解决方案 »

  1.   

    如果有数条记录的话,可以用游标来做。
    可以通过select count(health_content) into count_num from dw_health_content where sequence_no=2;来判断是否有记录集,是否为空
      

  2.   

    select 得到0条记录,可是health_content不是空值吗,为什么不直接走if的循环呢,我如果想让它执行后面的if循环需要怎么做呢,谢谢!!!
      

  3.   

    select语句会打开一个隐式游标,若结果集为空(即你这里select的结果是0),将引发no_data_found的异常,你需要捕获这个异常,在异常中写你的if代码
      

  4.   

    begin
      select health_content into out_content from dw_health_content where sequence_no=2;
      out_ret:=0;
    exceptioin
      when no_data_found then
        out_ret:=1;
    end;