ORA-00918: column ambiguously defined and rownum
707291Nov 10 2011 — edited Nov 10 2011I have a bunch of sqls in application with select distinct .. from .. where..
application restricts no of rows retrieved
earlier code uses to append where clause to add rownum < rownum_limit
i.e
select distinct .. from .. where..
and rownum <= &rownum_limit;
since distinct and rownum do not go well i have modified it to use subquery:
select * from (select distinct .. from .. where..
) where rownum <= &rownum_limit;
This is giving correct results but introduced another issue when subquery has duplicate column names its, started giving
ORA-00918: column ambiguously error.
I am dealing with application level changes so it may not be case of changing single sql and resolving columns with alias names.
Please suggest ?