lock table table_name in exclusive mode;加独占锁
lock table table_name in share mode;加共享锁

解决方案 »

  1.   

    lock table table_name in exclusive mode后是能读不能添加,删除,修改吗?可是我希望他连读都不能读
      

  2.   

    你不用给表加锁,你可以使用
    create global temporary table 语句创建临时表
    在使用时你的会话可以对其做任何操作,但其它会话看到的只是一张空表。
    具体语法为:
    create global temporary table tname (colu1   type1,colu2 type2,...)
    on commit [delete|preserve] rows