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

Home -> Community -> Usenet -> c.d.o.server -> Re: How can place NULL value in View definition?

Re: How can place NULL value in View definition?

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Fri, 17 Dec 1999 08:17:50 -0500
Message-ID: <hsdk5s4ieemrqfkrvk5iao7jd11mp0gj0k@4ax.com>


A copy of this was sent to laulau823_at_my-deja.com (if that email address didn't require changing) On Thu, 16 Dec 1999 17:05:43 GMT, you wrote:

>
>
>I want to UNION two table with the following SQL statement:
>
>create or replace view testing as
>select a.*, b.do DO from test1 a, test2 b where ...
>UNION
>select a.*, NULL DO from test1 a, test2 b where ...
>

select a.*, b.do do from test1 ....
union
select a.*, to_number(null) do from test1 .....

Also -- you might consider if you can use UNION ALL instead of just UNION.

A union B is really (A) + (B-A)
A union all B is really (A) + (B)

the union all is a simple concatenate of the 2 sets. union removes all rows in B that where already in A before it -- involves sorts and filters, can be slow on large sets.

>b.DO is integer type, however, I got the error message as the datatype
>mismatch in NULL column (NULL column is UNION with b.do column, I
>think integer type cannot match with NULL).
>
>Is it possible to place the NULL value (i.e. don't place anything) in
>the corresponding column in view definition?
>
>Thanks,
>David
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.

--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Fri Dec 17 1999 - 07:17:50 CST

Original text of this message

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