String sql2 = "select * from lobdemo for update;
    这句什么意思

解决方案 »

  1.   

    for update
    锁定表,只能查询不能写
      

  2.   

    [code=C#]
         
    数据库 oracle for update of   和   for update区别     
      select * from TTable1 for update 锁定表的所有行,只能读不能写 
      
    2  select * from TTable1 where pkid = 1 for update 只锁定pkid=1的行 3  select * from Table1 a join Table2 b on a.pkid=b.pkid for update 锁定两个表的所有记录 
      
    4 select * from Table1 a join Table2 b on a.pkid=b.pkid where a.pkid = 10 for update 锁定两个表的中满足条件的行 5. 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 后表的条件锁定相对应的表 [/code]
      

  3.   

    查询lobdemo表中的所有记录,并锁定该表
      

  4.   

    select * from lobdemo for update锁定lobdemo表,其它用户不能修改,只能查询
      

  5.   

    for update  就是锁住表lobdemo的记录,不被更改最好是加个
    select * from lobdemo for update nowait别人访问的时候 出现is busy
      

  6.   

    就是对大字段数据插入式  先执行insert into lobdemo  values(emp_clob(),emp_blob()); 然后再查询 select * from lobdemo for update 把查询到的 空的CLOB BLOB 数据 往里写数据
     我觉得直接写成这样 也可以啊 insert into lobdemo  values(?) ps.setBinaryStream(1, in, (int)file.length()); 有区别吗
      

  7.   

    锁定这张表,自己可以对这张表的数据做update操作,但是其他用户只能查询,这样容易引起死锁,最好不要做这样的操作!
      

  8.   

    select for update是一种悲观的锁定方法,即担心有其他会话会在查询与更新期间修改数据而造成丢失更新现象。从锁的类型来看,select for update将对select出的行加一个TX锁,另外与update等操作不同的是,select for update锁添加的Table Lock即TM锁的类型将是RS(Row Shared)的。
      

  9.   

    锁表是为了防止自己在修改过程中,别人也在修改此表。故自己有修改权,别人只有查询权。
    自己修改完后commit,释放锁。
      

  10.   

         
    数据库 oracle for update  of [conditon] 和 for update 的区别:    
    1  select * from TTable1 for update 锁定表的所有行,只能读不能写 
      
    2  select * from TTable1 where pkid = 1 for update 只锁定pkid=1的行 3  select * from Table1 a join Table2 b on a.pkid=b.pkid for update 锁定两个表的所有记录 
      
    4 select * from Table1 a join Table2 b on a.pkid=b.pkid where a.pkid = 10 for update 锁定两个表的中满足条件的行 5. 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 后表的条件锁定相对应的表