对比区别:
select * from TTable1 for update 锁定表的所有行,只能读不能写
select * from TTable1 where pkid = 1 for update 只锁定pkid=1的行
select * from Table1 a join Table2 b on a.pkid=b.pkid for update 锁定两个表的所有记录
select * from Table1 a join Table2 b on a.pkid=b.pkid where a.pkid = 10 for update 锁定两个表的中满足条件的行
select * from Table1 a join Table2 b on a.pkid=b.pkid where a.pkid = 10 for update of a.pkid 只锁定Table1中满足条件的行
for update 是把所有的表都锁定
for update of 根据of 后表的条件锁定相对应的表
如果加了for update后 该语句用来锁定特定的行(如果有where子句,就是满足where条件的那些行)。当这些行被锁定后,其他会话可以选择这些行,但不能更改或删除这些行,直到该语句的事务被commit语句或rollback语句结束为止。
分享到:
相关推荐
### 数据库Oracle锁:FOR UPDATE OF与FOR UPDATE的区别 在Oracle数据库中,为了确保数据的一致性和准确性,尤其是在多用户环境中进行并发操作时,锁机制是必不可少的一部分。本文将详细介绍`FOR UPDATE`与`FOR ...
sqlalchemy 对于行级锁有两种实现方式,with_lockmode(self, mode): 和 with_for_update(self, read=False, nowait=False, of=None),前者在sqlalchemy 0.9.0 被废弃,用后者代替。所以我们使用with_for_update ! 看...
通常情况下,我们会使用以下SQL语句来更新字段值: ...for x in xrange(10): sql = ''' UPDATE mytable SET myfield='value' WHERE other_field='other_value'; ''' 这种方法并没有什么任何错误,
例如:`BEGIN FOR cr IN (SELECT * FROM t_join_situation WHERE year='2011') LOOP UPDATE t_join_situation SET join_state='1' WHERE current of cr; END LOOP`。这种方式适用于大批量数据的更新,但需要注意游标...
in terms of reliability, accuracy or fitness for purpose. You assume the entire risk of direct or indirect, consequential or inconsequential results from the correct or incorrect usage of this ...
After messing around a bit with the perl tools available for extracting Huawei update.app files, i got the idea to create an own (windows) tool. Requirements .Net Framework 3.5 Install Extract the...
`Updating Form from Another Thread without Creating Delegates for Every Type of Update`这个主题探讨的是如何在不为每种类型的更新创建单独委托的情况下,从其他线程安全地更新UI。 通常,当你尝试在非UI线程...
触发器---FOR INSERT与INSTEAD OF 触发器是一种特殊的存储过程,它可以自动执行某些操作以响应特定的事件,如INSERT、UPDATE、DELETE等。触发器可以帮助我们自动执行一些必要的操作,以确保数据的一致性和完整性。...
ARM Compiler v5.01, Build 94, is intended for use as an update for ARM Compiler 5 and ARM DS-5 products, and must be used with a suitable license from one of those products. Multiple feature releases ...
这一法规是根据1958年联合国关于协调统一机动车及其零部件技术规定的协议(Agreement Concerning the Adoption of Harmonized Technical United Nations Regulations for Wheeled Vehicles, Equipment and Parts ...
Hotfix 1 for RAD Studio, Delphi XE5 Update 2 Available to registered users of Delphi XE5, RAD Studio XE5, and Embarcadero All-Access XE This hotfix supplies some missing lib file when installing ...
对于大量相似的更新操作,可以考虑使用BULK COLLECT和FORALL语句进行批量处理,以减少网络和数据库调用的开销: ```sql DECLARE TYPE col_table IS TABLE OF table_name.column_name%TYPE INDEX BY PLS_INTEGER; ...
然而,在城市和郊区地区,由于场景内容更为复杂以及道路网络结构的不同,此类研究相对较少。 #### 技术方案与算法描述 ##### 区域基础方法 本文提出的道路提取算法采用了一种区域基础的方法,首先使用归一化切割...
ARM Compiler v5.05, Build 169, is intended for use as an update for ARM Compiler 5 products, and must be used with a suitable license from one of these products. This update is not suitable for ...
The GNU Embedded Toolchain for Arm is a ready-to-use, open source suite of tools for C, C++ and Assembly programming targeting Arm Cortex-M and Cortex-R family of processors. It includes the GNU ...
RTL - VCL - THIRD PARTY - BOLD FOR DELPHI * VERIFYING THAT THE UPDATE WAS SUCCESSFUL * FILES INSTALLED BY THIS UPDATE =======================================================INSTALLING THIS UPDATE* ...
Please, update to the new Skype 8.x, which is ready for you with lots of improvements at Skype.com. In case you hit any issues, please check known issues, system requirements, or post your questions...
Please, update to the new Skype 8.x, which is ready for you with lots of improvements at Skype.com. In case you hit any issues, please check known issues, system requirements, or post your questions...
Delphi DirectX headers adaptation followed by Borland and JEDI standarts for all (up to 9.0 from April 2007 DirectX SDK update) versions of DirectDraw, Direct3D, DirectInput, DirectSound, DirectMusic,...