以下の内容はhttps://htn20190109.hatenablog.com/entry/2020/07/05/005649より取得しました。


更新件数取得

(5.6)

drop table tab1;
create table tab1(col1 int);
insert into tab1 values(1),(2),(3);
select * from tab1;

 

update tab1 set col1 = col1 + 100
where col1 > 1
;

select row_count();

 

(12cR1)

drop table tab1 purge;
create table tab1(col1 int);
insert into tab1 values(1);
insert into tab1 values(2);
insert into tab1 values(3);
commit;
select * from tab1;

set serveroutput on;
declare
ret varchar(100);
begin
update tab1 set col1 = col1 + 100
where col1 > 1
;
ret := to_char( SQL%ROWCOUNT );

dbms_output.put_line('SQL%ROWCOUNT = ' || ret );
end;
/

 

 

(9.4)

drop table tab1 cascade;
create table tab1(col1 int);
insert into tab1 values(1),(2),(3);
select * from tab1;

 

update tab1 set col1 = col1 + 100
where col1 > 1 returning *
;

 


(2014)

drop table tab1;
create table tab1(col1 int);
insert into tab1 values(1),(2),(3);
select * from tab1;

 

update tab1 set col1 = col1 + 100
where col1 > 1
;

print '@@ROWCOUNT = ' + cast(@@ROWCOUNT as varchar)

 




以上の内容はhttps://htn20190109.hatenablog.com/entry/2020/07/05/005649より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14