Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: view and null problem
The problem is on the type of NULL!
you have to cast this type:
create view person_view as
select name,age,null rank, to_number(null) salary from table1
union all select name, to_number(null) age,rank,salary from table2;
su_pat_at_my-deja.com a écrit dans le message <7ri4cu$1kg$1_at_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 - 04:48:37 CDT