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

Home -> Community -> Usenet -> c.d.o.server -> Re: How to Determine Whether to Insert or Update

Re: How to Determine Whether to Insert or Update

From: <Kenneth>
Date: Sun, 13 Mar 2005 14:30:12 GMT
Message-ID: <42344d13.6071328@news.inet.tele.dk>

>>
>>
>According to the docs (I'm using 10g) the source can be a subquery:
>
>MERGE
>INTO CHILD
>USING (SELECT P_ID AS ID, P_ID_ORDERING AS ORDERING
> FROM DUAL) AS S
>ON (S.ID = CHILD.PARENT_ID
> AND S.ORDERING = CHILD.ORDERING)
>WHEN NOT MATCHED THEN UPDATE SET <whatever>
>WHEN MATCHED THEN INSERT VALUES (...)
>
>Am I missing something?
>

Indeed you are. In fact the whole point of origin. The OP is on 9.2. And as I already stated, MERGE has been extended in 10g.

The Docs on 9i :



Use the MERGE statement to select rows from one *table* for update or insertion into another table.

The Docs on 10g:



Use the MERGE statement to select rows from one or more *sources* for update or insertion into one or more tables. Received on Sun Mar 13 2005 - 08:30:12 CST

Original text of this message

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