select b.merchant_id,b.merchant_name,b.merchant_type,b.merchant_big_type,t.*
from  echinacard.air_merchant b,echinacard.test_merchant t
where b.merchant_id = t.merchant_id       
and   t.merchant_type = '110' for update 
用这样的语句修改.为何出现无效的rowid错误呢

解决方案 »

  1.   

    --用这样的语句修改.为何出现无效的rowid错误呢
    ????修改什么呢? for update 是加锁的意思的嘛....搞不懂你什么意思
      

  2.   

    1. 可以连表查出多个表的字段for update锁住纪录
    2. 但是这个时候不能使用工具,例如plsql的sql窗口,然后直接在查询出来的数据上进行修改和提交,因为不确定你更新的到底是哪个表的数据
      

  3.   

    1. rowid可以说是实际纪录存储的物理地址
    2. 当需要连表更新数据的时候,ORACLE的写法就是
    update table_a
    set ...
    where ... and exists(select 1 from table_b where table_a.col = table_b.col and ...)
    通过转换成exists来实现3. 当使用for update锁住数据的时候,如果是单表更新,那么直接在查询出来的数据上进行修改是没有问题的,因为很容易根据操作的数据转换成update的SQL语句进行更新;如果是多表连接,查询出来的数据更新,就无法判断到底操作的哪个表或者哪几个表进行更新
      

  4.   

    楼上诸位说的有一些道理,不过可以直接指定rowid,如你上面的语句。
    如果你要修改b.merchant_name你就可以
    select   b.rowid,b.merchant_id,b.merchant_name,b.merchant_type,b.merchant_big_type,t.*
    from      echinacard.air_merchant   b,echinacard.test_merchant   t
    where   b.merchant_id   =   t.merchant_id
    and         t.merchant_type   =    '110 '   for   update
    然后再修改b的数据(开锁,Post Change, commit(F10))就可以了