我在做一个Reprot时,在其中写了一个公式有select into 语句。
当select 误句无查询到记录时,就出现错误,可以用exception去错误处理。
但现在我想让报表在查询到无记录时,就不再执行接下来的动作,给用户提示“无记录”,status不是error,是normal
应如何做?

解决方案 »

  1.   

    将该select into 放入一单独的begin ... end;块类似如下:begin   ...   begin
          select into ...;
       exception
          when no_data_found then
             null;
       end;   ...exception
       when ... then
          ...end;
      

  2.   

    那就定义一个应用程序异常,在exception里捕捉到no_data_found错误后,抛出该异常。
      

  3.   

    declare
       e_nodata    exception;
       PRAMGA exception_init(e_nodata,-1403);begin   ...
       select ... into ...;
       ...exception
       when e_nodata then
           ;--你想干吗,就在这干吗,只要合法。end;
      

  4.   

    suiziguo,我不是一个公式或者存储过程,是REPORT,所举的例是report中的一个公式。
    在此时我想要终止报表的执行,且把在此处捕获的错误信息返回给用户。
    不是仅对此公式进行异常处理。
    有强制终止报表执行的语句吗?
      

  5.   

    srw.program_abort强制终止报表的执行