我遇到的情况是我在PLSQL块中有多个DML语句,我想不知道任何行 当前会话中受影响的行(受DML语句影响的行)。
在不同的表上可能有50-100个DML语句,我不想在每一个DML语句后一次又一次使用SQL%ROWCOUNT,我们是否有任何选择可以使受影响的行总数一个特定的会话?
表结构:
create table client_A (
val_cli integer
,status varchar2(10)
);
create table client_B (
val_cli integer
,status varchar2(10)
);
create table client_C (
val_cli integer
,status varchar2(10)
);
虚拟值:
insert into client_A
select 1, 'void' from dual
union all
select 4, 'void' from dual
union all
select 1, 'void' from dual
union all
select 6, 'void' from dual
union all
select 10, 'void' from dual;
insert into client_B
select 1, 'void' from dual
union all
select 4, 'void' from dual
union all
select 1, 'void' from dual
union all
select 6, 'void' from dual
union all
select 10, 'void' from dual;
insert into client_C
select 1, 'void' from dual
union all
select 4, 'void' from dual
union all
select 1, 'void' from dual
union all
select 6, 'void' from dual
union all
select 10, 'void' from dual;
commit;
块:
begin
update client_A set status = 'ok' where val_cli = 1;
update client_B set status = 'ok' where val_cli = 1;
update client_C set status = 'ok' where val_cli = 1;
-- More DML Statements
commit;
end;
PS:可能存在50 -100 DML语句,所以我想避免使用ROWCOUNT,我正在寻找任何通用方法来获取给定会话或块中受影响的行数。