3

I can run this flashback query with no problem:

select x from a as of timestamp sysdate;

But if I use a table alias I get an error.

select foo.x from a foo as of timestamp sysdate;
ORA-00933: SQL command not properly ended

How can I use "as of" with table aliases?

Paul White
  • 94,921
  • 30
  • 437
  • 687
Mark Harrison
  • 829
  • 5
  • 20
  • 33

2 Answers2

4

The table alias follows the "as of" clause.

select x from a as of timestamp sysdate foo;
Mark Harrison
  • 829
  • 5
  • 20
  • 33
Raj
  • 912
  • 4
  • 5
1

And as an extension if you are joining multiple tables you can join them from different times if you want (not sure why you would want but...)

select *
from a as of timestamp sysdate-1 foo
join b as of timestamp sysdate-2 fi on foo.name = fi.name;
LWEBB
  • 11
  • 1