'XYZ' AS in union query gives ORA-00918
From: Thomas Poenicke <poenicke_at_freenet.de>
Date: Mon, 21 Jul 2008 13:02:59 +0200
Message-ID: <g61qd4$63f$1@mail1.sbs.de>
Date: Mon, 21 Jul 2008 13:02:59 +0200
Message-ID: <g61qd4$63f$1@mail1.sbs.de>
Hi,
I've created an union query like this:
select 'DB' AS SRC, some fields from a table
union
select 'UP' AS SRC, some fields from a view
order by 1 -- <-- id primary key
Both - table and view - have the same columns an without the "AS SRC" fields the query is corecctly processed.
Why Oracle throws me an 'ORA-00918: column ambiguously defined...' with the additional Column?
The sense of the query is to show changed data before applying the
changes.
The new and old rows are displayed together but without the SRC column
only an insider knows, what the source of the row is.
Thanks in advance and sorry for my cruel english ;) Thomas Received on Mon Jul 21 2008 - 06:02:59 CDT