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

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 20:19   2779   0
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 [color=red] //代表上面update语句影响的行数[/color]

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


end if ;
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP