Category Archives: oracle

Restore a messed up column

You’ve done an “update table set blah=’foo'” and forgotten to add the “where …” so the whole table is messed.

 

  • Create a temporary table using a flashback query
    create table mytemptable as (select * from myrealtable as of timestamp (SYSTIMESTAMP - INTERVAL '5' MINUTE));
  • copy data of column from one table to another
    update myrealtable set mycolumn=(select mycolumn from mytemptable where mytemptable.mycolumn=myrealtable.mycolumn);