Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: insert into table .... values....

Re: insert into table .... values....

From: Stephane Faroult <sfaroult_at_oriole.com>
Date: Thu, 30 Aug 2001 02:19:52 -0700
Message-ID: <F001.0037C8AF.20010830012459@fatcity.com>

Tatireddy, Shrinivas (MED, Keane) wrote:
>
> Hi lists
>
> how to do the folloiwng inserts into a table?
>
> table xyz has col1,col2, col3.
>
> I need to populate the values to col1 from table dummy1 (cola)
> col2 table dummy2(colb)
> col3 table dummy3(colc).
>
> there is no relation between dummy1 , dummy2, dummy3. We cannot join
> these tables.
>
> can I insert data into xyz in a single shot.
>
> is there anything like
> insert into xyz values((select cola from dummy1 where....),
> (select colb from dummy2 where....),
> (select colc from dummy3 where.... )
> );
>
> srinivas.

  insert into xyz

  select v1.cola,
         v2.colb,
         v3.colc
  from (select cola from dummy1 where ...) v1,
       (select colb from dummy2 where ...) v2,
       (select colc from dummy3 where ...) v3;

  But be certain that each of the WHERE conditions returns a single row (beware of cartesian products).
 IMHO it may be easier to spool the contents of dummy1, dummy2, dummy3 to flat files, load them into your favourite spreadsheet, do whatever you want, save it as a CSV file and load with SQL*Loader. It will probably take you less time.

--
Regards,

  Stephane Faroult
  Oriole Corporation
------------------------------------------------------------------
http://www.oriolecorp.com, designed by Oracle DBAs for Oracle DBAs
------------------------------------------------------------------
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroult
  INET: sfaroult_at_oriole.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Aug 30 2001 - 04:19:52 CDT

Original text of this message

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