Oracle 甲骨文:如何快速返回特定的专栏?
如何为表中的所有行回闪特定列 例如,给定此表:Oracle 甲骨文:如何快速返回特定的专栏?,oracle,flashback,Oracle,Flashback,如何为表中的所有行回闪特定列 例如,给定此表: select * from t as of scn 1201789714628; a b - - x 1 y 2 z 3 select * from t; a b - - x 4 y 5 z 6 我可以按如下方式闪回特定行中的一列: update t set b = (select b from t as of scn 1201789714628 where a='x') where a='x'; select * from
select * from t as of scn 1201789714628;
a b
- -
x 1
y 2
z 3
select * from t;
a b
- -
x 4
y 5
z 6
我可以按如下方式闪回特定行中的一列:
update t set b = (select b from t as of scn 1201789714628 where a='x') where a='x';
select * from t;
a b
- -
x 1
y 5
z 6
但我无法理解将所有行的b设置为其先前值的语法
update t t1 set b = (select b from t as of scn 1201789714628) t2 where t1.a = t2.a;
Error at Command Line:11 Column:60
SQL Error: ORA-00933: SQL command not properly ended
你可以试试这个:
update t t1
set b = (select b from (select a, b from t as of scn 1201789714628) t2
where t1.a = t2.a);
另外,如果您现在不打算更新快照,我建议您将快照复制到临时表中(它可能很快就会消失)。Brilliant,效果非常好!正是我所需要的,非常感谢你。