[SQL ] mysql stored procedure中如何lock table

楼主: assoco (nice)   2014-06-09 13:35:49
数据库名称:MySQL
数据库版本:5.6.5
内容/问题描述:
请问Mysql Stored Procedure中如果要Lock Table要怎么做呢?
程式逻辑是先把一笔资料取出来..
然后把这笔资料update取出的状态
但是当大量执行的时候会发生多个connection取到同一笔资料的情况
想加入Lock Tables WRITE
但是出现lock is not allowed in stored procedures
若是用transaction可以解决此问题吗?
还是有其他更好的作法呢?

Links booklink

Contact Us: admin [ a t ] ucptt.com