Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: NULLS in union of two tables
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