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: multi-table insert in Oracle 9i

Re: multi-table insert in Oracle 9i

From: Dave Hau <davehau_nospam_123_at_nospam_netscape.net>
Date: Fri, 27 Jun 2003 00:26:41 GMT
Message-ID: <3EFB8F40.9070709@nospam_netscape.net>


You're missing a "THEN" keyword:

insert all when 1=1 THEN
into junk (id, order_num, sequence_num) ...

Also, if the condition is 1=1, you don't need to specify it at all:

insert all
into junk (id, order_num, sequence_num) ...

does the same thing.

Cheers,
Dave

Niloufar wrote:
> Could someone please tell me what am I doing wrong that causes both of
> the following multi-table insert statements to fail with a "missing key"
> error. My Oracle server is Version 9.2.0.2.0.
>
> Thanks,
> Niloufar
>
> *******************************************************************************
>
> create table junk(id number,order_num varchar2(10),bill_amt number);
> create table junk2(id2 number,order_num2 varchar2(10),bill_amt2 number);
> create table junk_input(order_id number,order_number
> varchar2(10),bill_amt number);
>
> insert into junk_input values (1, '1234', 10);
> insert into junk_input values (2, '1234', 10);
> insert into junk_input values (3, '1234', 10);
> insert into junk_input values (4, '5678', 10);
> insert into junk_input values (5, '5678', 10);
> select * from junk_input;
>
> tried both:
>
> insert all when 1=1
> into junk (id, order_num, sequence_num)
> select order_id, order_number, seq_num from junk_input;
>
> and tried:
>
> insert all when 1=1
> into junk (id, order_num, sequence_num)
> when order_number = '5678'
> into junk2 (id2, order_num2, sequence_num2)
> select order_id, order_number, seq_num from junk_input;
>
>
Received on Thu Jun 26 2003 - 19:26:41 CDT

Original text of this message

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