Re: 'XYZ' AS in union query gives ORA-00918

From: <>
Date: Mon, 21 Jul 2008 05:13:41 -0700 (PDT)
Message-ID: <>

On Jul 21, 6:02 am, Thomas Poenicke <> wrote:
> 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

We need to see what you've written for these 'other columns from' parts of the UNION; you should have posted the entire query as written.

Do so, as we can't know what your issues are until you post that entire query text.

David Fitzjarrell Received on Mon Jul 21 2008 - 07:13:41 CDT

Original text of this message