sql 中 sql%rowcount 判断执行SQL受影响的行数

sql  中 sql%rowcount 判断执行SQL受影响的行数

例子:
update work_order
       set order_state = '1'
     where line_id = p_line_id
       and order_state = '0'
       and order_type = 'DPY'
       and ORDER_PRIORITY = (select min(ORDER_PRIORITY)
                               from work_order
                              where order_state = '0'
                                and order_type = 'DPY'
                                and LINE_ID = p_line_id
                                and order_priority > 0
                              group by LINE_ID)
        and exists
               (select 1
                        from product_level pl
                       where pl.pid = pid
                         and pl.child_pid =
                             (select (select pid
                                        from product_maintain pm
                                       where pm.product_number =
                                             rw.material_number
                                         and pm.rstate = rw.material_rstate)
                                from routing_wip rw
                               where rw.sn = p_sn))
        and rownum <= 1;

   if  sql%rowcount > 1 then      //代表上面update语句影响的行数

   raise_application_error (-20015,
                           'Work order with same priority in the waiting queue ! ');


   end if ;
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值