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 13:26:43 GMT
Message-ID: <42343c6b.1806640@news.inet.tele.dk>


On Sun, 13 Mar 2005 06:59:37 -0500, Serge Rielau <srielau_at_ca.ibm.com> wrote:

>> Avi.
>take a peek at the MERGE statement.
>
>Cheers
>Serge
>
>--
>Serge Rielau
>DB2 SQL Compiler Development
>IBM Toronto Lab

The MERGE utility is not usable here. It only merges 2 *tables* (in 9i, 10g extends this a bit) , but here you have a set of values to be merged into a table, which MERGE is incapable of handling.

Instead, simply :

begin
  if sql%rowcount = 0 then

OR

declare
  DUPLICATE_ROW Exception;
  pragma Exception_init(DUPLICATE_ROW,-1); begin
 insert into child values(in_parentid,........);  exception

Received on Sun Mar 13 2005 - 07:26:43 CST

Original text of this message

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