Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need help in defining Null vlaues to a cloumn in SQL developer

Mrudula BandaruAug 12 2012 — edited Aug 13 2012
Hi All,

I have view in SQL which is union of 2 tables...sales and orders.

to define view...we hould have same no. of column in both the tables..due to their functionality difference..there are certain columns of orders table which are not in sales..so I defined them in sales union and replaced it with null..as we do not want any data for these columns..here comes the problem during execution..

null ordertype from sales;+ ..this works perfectly when I run the sales piece separately..but when i use union and use it..it doesn't give any result...this is because..

null ordertype from sales;* is assgning data type of varchar2(0) to the column ordertype..

so i tried..

null orders.ordertype
from sales,orders ------ gives error

orders.ordertype from
sales,orders ------data type of the column is retained, but i cannot assign null values to the column

can you suggest me a way where I can retain the data type of the column name as well as set values of that column to null..

Thanks in advance..
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 10 2012
Added on Aug 12 2012
5 comments
172 views