如何進行批量更新操作

2021-05-24 12:03:33 字數 1364 閱讀 2805

在進行大批量資料更新的時候,往往採用批量更新的方式,以下俺寫了個例子,請大家參考一下:

--建立表

create table test1

(a varchar2(100),

b varchar2(100)

);  

create table test2

(a varchar2(100),

b varchar2(100)

); --插入語句 

declare i number; 

begin

for i in 1..10 loop  

insert into test1(a,b)values(i,i);

end loop; 

for i in 1..5 loop  

insert into test2(a,b)values(i,i||i);

end loop; 

end; 

--查詢一下:

select t.*,t.rowid from test1 t

select t.*,t.rowid from test2 t  

--全都更新的方式:

update test1 t1

set t1.b = (select t2.b from test2 t2 where t1.a = t2.a) 

--如果沒有以下語句結果就不一樣了,請注意

where exists

(select '' from test2 t2 where t1.a = t2.a);

--開始批量更新

declare

countpoint number := 0;

begin

for row_id in (select t1.rowid,t2.b from test1 t1,test2 t2 where t1.a = t2.a) loop

update test1 t1

set t1.b = row_id.b

where t1.rowid = row_id.rowid;

countpoint := countpoint + 1;

if mod(countpoint, 5) = 0 then

dbms_output.put_line('countpoint:' || countpoint);

commit;

end if;

end loop;

commit;

end;  

--刪除資料

delete test1;

delete test2;

--刪除表

drop table test1;

drop table test2; 

如何進行svn relocate 操作

1。進入工作複本 cd test2。檢視倉庫位址 url svn info 路徑 檔案庫 uuid a81f9bed 3506 0410 b369 e50476f75162 修訂版 44 節點種類 目錄 排程 正常 最後修改的修訂版 443。更改倉庫位址 url svn switch relocat...

如何進行svn relocate 操作

1。進入工作複本 cd test2。檢視倉庫位址 url svn info 路徑 檔案庫 uuid a81f9bed 3506 0410 b369 e50476f75162 修訂版 44 節點種類 目錄 排程 正常 最後修改的修訂版 44 3。更改倉庫位址 url svn switch reloca...

Apple蘋果終端如何進行批量管理

1.裝置註冊簡單靈活 可通過dep asm url多種方式進行裝置註冊。2.精細化多層級的許可權管控 教師與it管理員許可權分離,完美整合ad域,按年級 班級 個人多層級控制。3.統一資產管理 除詳細的裝置資訊 如配置檔案 使用者 儲存 電池電量 序列號 作業系統 用用程式等 蒐集外,還可實現統一的...