也许有很多朋友会发现,这种锁不是和共享锁很相似吗?但是共同享锁是允许多个用户在同一个表中放置多个共享锁的,而排他锁只允许一个用户在表中放置排他锁,所以说,如果我在一个表中放置了排他锁的话,别人就不能再在这个表中放置排他锁的。在oracle中使用排他锁的具体格式为:
lock table emp in exclusive mode
,
这样我们就对表emp放置了排他锁了。
UPDATE s1 SET a=(SELECT b FROM s2 WHERE id=1) WHERE id=1这样可以,但是你说同一张表中将a字段的值update给b字段这是不行的。
重新启动MySQL:[root@bogon ~]# /etc/rc.d/init.d/mysql restart
Shutting down MySQL [ 确定 ]
Starting MySQL. [ 确定 ]
[root@bogon ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with or \g.
Your MySQL connection id is 1
Server version: 5.1.22-rc-community-log MySQL Community Edition (GPL)
Type 'help' or '\h' for help. Type '\c' to clear the buffer.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)