在 oracle 数据库中没有 where 的情况下更新到的回滚列
rolback column to which it was updated without where in oracle database
早上好,在 Oracle 数据库中执行 SQL 查询期间,执行更新而不使用 where 并无意中更新了整个列,现在我想通过回滚检索它,问题是如何进行更新以更新我正在恢复的专栏。
要检索我的专栏,您正在使用以下查询:
select CONTENT
from ACTION as of timestamp
to_timestamp('21-NOV-2019 11:30:00', 'DD-MON-YYYY HH24:MI:SS');
现在我希望这个查询的响应作为一个参数来更新(更新)我的 ACTION table 的整个 CONTENT 列;就像当时一样。
您可以使用简单的更新语句。我正在考虑您只需要将列值更新为过去的值,但所有其他数据都需要保持不变。
Update action a
Set a.content = (select * from (select b.CONTENT from ACTION b
Where b.primarykey_colum = a.primarykey_colum) as of timestamp to_timestamp('21-NOV-2019 11:30:00', 'DD-MON-YYYY HH24:MI:SS'));
如果你想闪回整个 table 然后使用以下:
FLASHBACK TABLE action
TO TIMESTAMP to_timestamp('21-NOV-2019 11:30:00', 'DD-MON-YYYY HH24:MI:SS');
干杯!!
早上好,在 Oracle 数据库中执行 SQL 查询期间,执行更新而不使用 where 并无意中更新了整个列,现在我想通过回滚检索它,问题是如何进行更新以更新我正在恢复的专栏。 要检索我的专栏,您正在使用以下查询:
select CONTENT
from ACTION as of timestamp
to_timestamp('21-NOV-2019 11:30:00', 'DD-MON-YYYY HH24:MI:SS');
现在我希望这个查询的响应作为一个参数来更新(更新)我的 ACTION table 的整个 CONTENT 列;就像当时一样。
您可以使用简单的更新语句。我正在考虑您只需要将列值更新为过去的值,但所有其他数据都需要保持不变。
Update action a
Set a.content = (select * from (select b.CONTENT from ACTION b
Where b.primarykey_colum = a.primarykey_colum) as of timestamp to_timestamp('21-NOV-2019 11:30:00', 'DD-MON-YYYY HH24:MI:SS'));
如果你想闪回整个 table 然后使用以下:
FLASHBACK TABLE action
TO TIMESTAMP to_timestamp('21-NOV-2019 11:30:00', 'DD-MON-YYYY HH24:MI:SS');
干杯!!