天天看點

Oracle中在pl/sql developer修改表的兩種語句

一、方式一

select * from student for update

student表需要操作人修改完commit之後才可以做其他的操作,否則該表會被鎖住。

二、方式二

select t.*,t.rowid from student t

在pl/sql developer中右擊某表,顯示的就是該語句,這樣做不會将該表鎖住。

想修改某幾個字段也沒有問題select num,name,t.rowid from student t。

該種方式也可修改多表聯合查詢的情況,現有table1和table2兩張表,需要關聯查詢,需要修改的字段在table1中。

select t1.*,t1.rowid from table1 t1,table2 t2 where .......

要取得t1.rowid才可以進行修改。

本文轉自IT徐胖子的專欄部落格51CTO部落格,原文連結http://blog.51cto.com/woshixy/1144353如需轉載請自行聯系原作者

woshixuye111