Recovering deleted Records

KTB picture KTB · Mar 11, 2013 · Viewed 16.3k times · Source

I have accdently deleted some rows in a table and did the commit too. Now I want to recover them.

The DB I'm using is Oracle 11g R2.

I used the following query to get deleted records:

SELECT * FROM MY_TABLE AS OF TIMESTAMP ('13-MAR-11 8:50:58','DD-MON-YY HH24: MI: SS')

But while executing it gives an error saying:

Error at Command Line:3 Column:75
Error report:
SQL Error: ORA-00907: missing right parenthesis
00907. 00000 -  "missing right parenthesis"
*Cause:    
*Action:

But I couldn't figure the problem in this queury.

Can anyone pls help?

Answer

Mat picture Mat · Mar 11, 2013

That requires an actual timestamp (or date), you're passing a pair of values.

Try:

SELECT * FROM MY_TABLE
AS OF TIMESTAMP TO_DATE('13-MAR-11 08:50:58','DD-MON-YY HH24:MI:SS')

(Your time format specifier isn't correct either and doesn't match your date string.)