update table2 set d=(select b from table1 where table1.a=table2.c);我实验了一下,没问题呀,

解决方案 »

  1.   

    update a
    set a.huh = (select b.huh from b where a.id(+) = b.id);
      

  2.   

    asa下试验:
    update tab2,tab1
    set tab2.a=tab1.a
    where tab1.id=tab2.id;
      

  3.   

    你要确保 select b.huh from b where a.id = b.id 出来的记录数为一条,即b表中的id 也应该是主键,否则会报错
      

  4.   

    a表的数据量有17万条,执行了有两分钟后出错,错误号是1562和1628。to  yanleigis(可可):
    你的方法也不行,错误号是1705:无法在关联列中指定外部连接。
      

  5.   

    to fibbery(惊魂一梦,飞上云霄):
    oracle中update后面好像只能有一个表名,所以我用这种写法to zzok1():
    b表中的id是唯一关键字
      

  6.   

    我说不行的道理是:
    在select语句中检索出来的肯定是许多条记录,让一个字段去等于一大堆数据,我不太明白。
      

  7.   

    to fibbery(惊魂一梦,飞上云霄):
    那应该怎么写呢?不用一条sql也行,只要能达到我的目的。谢谢!
      

  8.   

    但一定要保证子查询中取得的记录对于被更新表中的数据是唯一的。否则,update失败。
      

  9.   

    因为a表是个历史记录表,我不能保证a表中的所有id在b表中都能找到。
      

  10.   

    例如:tab1是子查询表,tab2为被更新表
    tab1:                   tab2:
    id        a             id            a
    1         a1            1             
    2         a2            2
    3         a3            
    这样可以成功
    如果:
    tab1:                   tab2:
    id        a             id            a
    1         a1            1             
    2         a2            2
    2         a22            
    则不可以。
      

  11.   

    是的:
    ORA-01562 failed to extend rollback segment number string
    Cause: Failure occurred when trying to extend rollback segment. Action: This is normally followed by another error message that caused the failure. You may take the rollback segment offline to perform maintenance. Use the ALTER ROLLBACK SEGMENT OFFLINE command to take the rollback segment offline.ORA-01628 max # extents (string) reached for rollback segment string
    Cause: An attempt was made to extend a rollback segment that was already at the MAXEXENTS value. Action: If the value of the MAXEXTENTS storage parameter is less than the maximum allowed by the system, raise this value.记录太多,回滚段已经到达最大值。两种方法,一种是offline回滚段,一种是增加回滚段空间(或者回滚段数量)。
      

  12.   

    ORA-01562 failed to extend rollback segment number stringCause: Failure occurred when trying to extend rollback segment.Action: This is normally followed by another error message that caused the failure. You may take the rollback segment offline to perform maintenance. Use SELECT SEGMENT_NAME FROM DBA_ROLLBACK_SEGS WHERE SEGMENT_ID=string (where string is the segment number from the message) to determine the rollback segment name. Then use the ALTER ROLLBACK SEGMENT OFFLINE command to take the rollback segment offline. ORA-01628 max # extents (string) reached for rollback segment stringCause: An attempt was made to extend a rollback segment that was already at the MAXEXENTS value.Action: If the value of the MAXEXTENTS storage parameter is less than the maximum allowed by the system, raise this value.
    可能是错误太多,回滚段放不下了。
    先暂时在前端用pb的datawindow来实现了。
      

  13.   

    不是错误太多,因为你是在支持事务的情况下更新数据表,所以,会滚段要记录你的每一次更新操作,以备rollback,但是,记录太多,回滚段溢出,所以报错了。
      

  14.   

    怎么会溢出呢?我在前台用pb一次插入几百万条记录,最后再commit都没事啊?
      

  15.   

    我觉得你可以分批更新,用rownum来作限制,比如,第一次rownum<10000,commit;第二次rownum<20000,commit;......
      

  16.   

    请问,记录太多,回滚段到达最大值。offline回滚段,可以完成吗?
      

  17.   

    OFFLINE回滚段以后就是不支持事务,所以,不会报上面的错误,执行完成后,还要让他online!