QBE and ORA-00918

staffanmw

Member²
Hi,

I've got a TOracleDataSet witch I join three tables, ruffly like this:

select a.rowid, a.no, a.name
from tab1 a, tab2 b, tab3 c
where a.no = b.no
and a.no = c.no

As you see I've got the column name 'no' in all tables .. this is the problem when I define the column 'no' as a queryabled column. I get a ORA-00918 error due to ambiguously defined columns. If I start the DOA debug facility I can se in the SQL statement:

select a.rowid, a.no, a.name
from tab1 a, tab2 b, tab3 c
where a.no = b.no
and a.no = c.no
and
(NO = :doa__qbe2)
/* Modified for QBE */

As I see it the '(NO = :doa__qbe2)' shuld be like '(a.NO = :doa__qbe2)'
or '(tab1.NO = :doa__qbe2)'

I have the property UpdatingTable set to 'tab1', but it shuld not matter ...

What I need is to be able to set a prefix in the QBE statment.

Regards,
Staffan
 
Well, it is possible to write the statement in a diffrent way .. that solves the problem:

select a.rowid, a.no, a.name
from tab1 a
where a.no in (select b.no from tab2 b)
and a.no in (select c.no from tab3 c)

I think it was a bit to easy to submit a question into the forum .. sorry.
 
Back
Top