Re: MERGE Help
Date: 29 May 2003 09:48:46 -0700
Message-ID: <2f50b64b.0305290848.79fe7669_at_posting.google.com>
MERGE INTO <table_b as old_t>
USING <selected records from table_A as new_t>
on ( old_t.id = new_t.id )
when MATCHED then update set old_t.data = new_t.data
when NOT MATCHED then insert (id,data) values(new_t.id,new_t.data);
Will work in Oracle 9i
lefebvre_at_iwavesolutions.com (Marc A. Lefebvre US-775) wrote in message news:<5ef1a86c.0305282231.580c5df_at_posting.google.com>...
> I want to use the Oracle DML statement called MERGE. I understand the
> syntax and all but need help fomulating the INSERT and UPDATE clauses.
>
> If I have a Table A and a Table B which have the same schema. I would
> like to insert Table A into Table B, for the records that dont exist,
> and update for the records that do exist for the Primary Key. What is
> the most efficient method to do this and what would the resulting
> MERGE statement look like.
>
> Thanks!
>
> Marc
Received on Thu May 29 2003 - 18:48:46 CEST