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: NULLS in union of two tables

Re: NULLS in union of two tables

From: Chrysalis <cellis_at_iol.ie>
Date: Thu, 04 Jun 1998 11:52:17 +0100
Message-ID: <cellis-ya02408000R0406981152170001@news.clubi.ie>


In article <6l1233$88e_at_scorpion.LaTech.edu>, jperonto_at_engr.latech.edu (Julie A. Peronto) wrote:

> I am creating a view that is the union of two tables that hold different
> information about like objects. There are some fields that exist in
> both tables & other fields that exist in one or the other table. The
> union will hold a combination of the two.

> snip

> I have tried the following select statements in the creation of the view:
>
> select wr_no, wr_type, NULL wr_status
> from table_1
> union
> select wr_no, NULL wr_type, wr_status
> from table_2
>
>snip

You need to "coerce" the datatypes to be the same: select wr_no, wr_type, to_char(NULL) wr_status from table_1
 union
select wr_no, NULL wr_type, wr_status
from table_2

Similarly, if the corresponding datatype is numeric, then use to_number(null)

HTH --
Chrysalis Received on Thu Jun 04 1998 - 05:52:17 CDT

Original text of this message

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