update to_id set to_context=(select from_context from from_id where from_id.id=to_id.id) where exists (select 1 from from_id where from_id.id=to_id.id);
晕!没看清表名 更正 update B set from_context=(select to_context from A where A.from_id=B.to_id) where exists (select 1 from A where A.from_id=B.to_id);
头晕了,这是追加的SQL INSERT INTO A ( from_id,from_context ) SELECT to_id,to_context FROM B where A.from_id <> B.to_id 更新的SQL:UPDATE B SET B.to_id = A.from_id,B.to_context = A.from_context where A.from_id = B.to_id问题是clob如此更新报错,请大侠不吝赐教。
将 INSERT INTO A ( from_id,from_context ) SELECT to_id,to_context FROM B where A.from_id = B.to_id 放到存储过程中试试
njhart2003,waterfirer(水清)的是正解, TO zengguochao1980(大地):我试了一下,INSERT INTO A ( from_id,from_context )的写法在oracle里会出错。 TO dbpointer(苞谷) :不好意思,我回得太慢了。 谢谢大家.
set to_context=(select from_context from from_id where from_id.id=to_id.id)
where exists (select 1 from from_id where from_id.id=to_id.id);
更正
update B set from_context=(select to_context from A where A.from_id=B.to_id)
where exists (select 1 from A where A.from_id=B.to_id);
INSERT INTO A ( from_id,from_context ) SELECT to_id,to_context FROM B where A.from_id <> B.to_id
更新的SQL:UPDATE B SET B.to_id = A.from_id,B.to_context = A.from_context where A.from_id = B.to_id问题是clob如此更新报错,请大侠不吝赐教。
放到存储过程中试试
TO zengguochao1980(大地):我试了一下,INSERT INTO A ( from_id,from_context )的写法在oracle里会出错。
TO dbpointer(苞谷) :不好意思,我回得太慢了。
谢谢大家.