Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Problems with MERGE INTO statement
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, USAReceived on Sat Jan 22 2005 - 16:51:05 CST
![]() |
![]() |