Path: text.usenetserver.com!out01b.usenetserver.com!news.usenetserver.com!in02.usenetserver.com!news.usenetserver.com!postnews.google.com!f1g2000cwa.googlegroups.com!not-for-mail
From: "vnr1995@gmail.com" <vnr1995@gmail.com>
Newsgroups: comp.databases.oracle.server
Subject: Re: INSERT with WHERE???
Date: 12 Dec 2006 09:20:35 -0800
Organization: http://groups.google.com
Lines: 33
Message-ID: <1165944035.893152.83330@f1g2000cwa.googlegroups.com>
References: <1165935144.422612.292890@16g2000cwy.googlegroups.com>
   <1165936331.186169.143280@n67g2000cwd.googlegroups.com>
   <1165942165.406512.4090@j72g2000cwa.googlegroups.com>
NNTP-Posting-Host: 12.43.229.154
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-Trace: posting.google.com 1165944041 9148 127.0.0.1 (12 Dec 2006 17:20:41 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 12 Dec 2006 17:20:41 +0000 (UTC)
In-Reply-To: <1165942165.406512.4090@j72g2000cwa.googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: f1g2000cwa.googlegroups.com; posting-host=12.43.229.154;
   posting-account=95JizA0AAABwxgN1EZEefK7GYVB4YZgG
Xref: usenetserver.com comp.databases.oracle.server:419027
X-Received-Date: Tue, 12 Dec 2006 12:20:41 EST (text.usenetserver.com)


ASK wrote:
> Hi,
>
> Could you illustrate the below by some example?
> INSERT
>  WHEN (<condition>) THEN
>    INTO <table_name> (<column_list>)
>    VALUES (<values_list>);

I read it here:
http://www.psoug.org/reference/insert.html

create table inswhen(a number, b number);

insert into inswhen values (1, 2);
insert into inswhen values (2, 3);

insert
when (a + b = 3) then
   into inswhen values (6, 7)
else
   into inswhen values (a, b)
select 1 a, 1 b from dual where 1=0;

The OP would better go with merge

merge into inswhen
  using dual
on <condition>
when not matched then
insert;

