在存储过程中执行一个sql语句,如果执行后没有结果,就会报错.想在结果为空的时候执行另一个操作,怎么判断结果为空呢?(结果为两个字段)

解决方案 »

  1.   

    执行后没有结果是指 执行sql语句查询结果为空吗 
    那你执行select count(*) as num from 
    执行完判断num是不是等于0就行了
    也可以用sql%rowcount查看执行的行数
      

  2.   

    select count (*) as num from ……然后通过 num 做个判断是个好方法,我试过了 可行!
      

  3.   

    用cursor.. fetch c_business_activity_invoice
            into v_business_activity_invoice;
    if c_business_activity_invoice%not found
      then
    else