Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Inserting records from two different sources
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),
... );