Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Problems with MERGE INTO statement

Re: Problems with MERGE INTO statement

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Sat, 22 Jan 2005 15:50:12 -0800
Message-ID: <41f2e6ac$1_2@127.0.0.1>


Matthias Wirtz wrote:

> Hi,
>
> I'm playing with the merge into statement but got stuck on this easy thing:
>
> stat_at_DEV> CREATE TABLE t1 (id NUMBER, value NUMBER);
>
> Table created.
>
> stat_at_DEV>
> stat_at_DEV> MERGE INTO t1
> 2 USING t1 ON (id = 1)
> 3 WHEN MATCHED THEN UPDATE SET value = 20
> 4 WHEN NOT MATCHED THEN INSERT (id, value) VALUES (1, 20);
> WHEN MATCHED THEN UPDATE SET value = 20
> *
> ERROR at line 3:
> ORA-00918: column ambiguously defined
>
>
> I thought that would be an easy example. I want to add a entry into t1 but
> do not know if there is already an entry with id=1. So I thought using merge
> could save me the query in the beginning. Maybe someone could point me to
> the problem.
> --
> Matthias Wirtz - Norfolk, USA

You will find an easy example you can use at http://www.psoug.org click on Morgan's Library
click on Merge Statement

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Sat Jan 22 2005 - 17:50:12 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US