Getting Invalid SQL syntax when using SCN and table alias

129 Views Asked by At

I am trying to fetch XMLType data as a String using commit SCN value as

SELECT ab.userdata.getStringVal() userdata from MINER.MINERT2 ab  as of
scn(1558393) where ab.ID = 14; 

But I am getting SQL syntax error. When I use a normal query, without table alias say

select col from tablename as of scn(1234) where id=1

I do not get any syntax errors.

1

There are 1 best solutions below

0
On

I found the mistake. table alias must be written after as of SCN().

So the query

SELECT ab.userdata.getStringVal() userdata from MINER.MINERT2 ab  as of
scn(1558393) where ab.ID = 14;

must be corrected to

SELECT ab.userdata.getStringVal() userdata from MINER.MINERT2  as of
scn(1558393) ab where ab.ID = 14;