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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Adding rows from two tables into a new table.

Re: Adding rows from two tables into a new table.

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Sat, 02 Oct 1999 17:29:53 GMT
Message-ID: <37f640ad.15644126@news.demon.nl>

declare
cursor unite is
select *
from table1
union
select *
from table2;
begin
for r_unite in unite loop
end loop;

This is of course the number of columns and their respective datatypes are identical.

Hth,

Sybrand Bakker, Oracle DBA

On Sat, 02 Oct 1999 17:11:01 GMT, screwbai_at_my-deja.com wrote:

>I have two table that I want to add the rows together into one table.
>
>Example
>
>table1:
>-------
>A B
>C D
>
>table2
>------
>E F
>G H
>
>Then I want to end up with a table that has all four rows in it like
>this.
>tableresult:
>--------
>A B
>C D
>E F
>G H
>
>I can acomplish this by creating a temporary table and select into it.Or
>having a permanet table that I truncate everytime I execute the process.
>I am using a the tableresult as a virtual table in a cursor. So I am
>trying to avoid the use of temporary tables. Can something like this be
>done in a select statement.
>
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Received on Sat Oct 02 1999 - 12:29:53 CDT

Original text of this message

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