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: insert into one table with selects from 4 others

Re: insert into one table with selects from 4 others

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sat, 13 Mar 1999 00:11:46 GMT
Message-ID: <36ebace0.2509498@192.86.155.100>


A copy of this was sent to chrisoc_at_ans.net (if that email address didn't require changing) On Fri, 12 Mar 1999 21:35:27 GMT, you wrote:

>
>
>I need some sample syntax doing this:
>

I think you want to insert/select. you seem mixing update and insert together... but anyway see if:

insert into tablea ( v1, v2, v3, v4 )
select *

  from ( select sysdate v1 from dual ),
       ( select sum(something) v2 from tableb ),
       ( select min(something) v3 from tablec ),
       ( select avg(something) v4 from tabled )
/

>Update TableA insert (V1, V2, V3 V4)
>using (select sysdate from dual V1, select sum(something) from TableB V2,
> select min(something) from TableC V3, select avg(something) from TableD V4)
>
>assume the data types are 100% compatible
>
>Thanks
>I am stumbling around and cannot hit on the syntax to make SQLPlus happy.
>
>Chris O'Connor
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Fri Mar 12 1999 - 18:11:46 CST

Original text of this message

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