Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to Determine Whether to Insert or Update
>>
>>
>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 :
The Docs on 10g:
![]() |
![]() |