Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Inserting records from two different sources
Lamar Youngers wrote:
> I am attempting to INSERT records from two identical tables in two
> different schemas into one table using a single SQL statement, Could
> one do this by using DECODE in the INSERT statement?
>
> EX:
>
> Given tables a, b_at_a, b_at_b, and c, can something like this be done?
>
> INSERT INTO c VALUES
> (DECODE (a.table_schema,
> 'a',b.column1_at_a,
> 'b',b.column1_at_b),
> DECODE (a.table_schema,
> 'a',b.column2_at_a,
> 'b',b.column2_at_b),
> ...
> );
> etc.
>
How about:
INSERT INTO destination_tables
(SELECT * FROM source_table1
UNION
SELECT * FROM source_table2);
Or something like that....
HTH,
Brian
-- =================================================================== Brian Peasland dba_at_nospam.peasland.net http://www.peasland.net Remove the "nospam." from the email address to email me. "I can give it to you cheap, quick, and good. Now pick two out of the three" - Unknown -- Posted via a free Usenet account from http://www.teranews.comReceived on Tue Aug 28 2007 - 16:05:36 CDT
![]() |
![]() |