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 -> view and null problem

view and null problem

From: <su_pat_at_my-deja.com>
Date: Mon, 13 Sep 1999 06:08:35 GMT
Message-ID: <7ri4cu$1kg$1@nnrp1.deja.com>


Hi,
  I have problem in creating a view of 2 tables which has not the same columns.
sql>desc table1;

    column datatype


    name         varchar2(10)
    age          number
sql>desc table2;
    column       datatype

---------------------
name varchar2(10) rank varchar2(15) salary number

And then I create a view like this,it's ok.(I think it's ok because rank is varchar2)
sql>create view person_view as

    select name,null rank from table1
    union all select name,rank from table2;

But then I create a view of 2 table by union of all column. sql>create view person_view as

    select name,age,null rank,null salary from table1     union all select name,null age,rank,salary from table2;

It's error that->Expression must have same datatype as corresponding expression (I think it's error because column age and salary is number so they're not allowed for null?) But I don't want age,salary value which have not value in view be 0 too.
Thank.
Supat.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Mon Sep 13 1999 - 01:08:35 CDT

Original text of this message

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