Error in view [message #467998] |
Wed, 28 July 2010 08:51 |
Amar_bu
Messages: 32 Registered: July 2010 Location: riyadh
|
Member |
|
|
I have an erorr and i could not discover it. any help ????
create view Employee_other as
(select tel_employee.Badage As badge,tel_employee.emp_office_id as office,tel_offices.office_name_en as office_name
,tel_offices.city_code as city_code,tel_offices.country_code as country_code,tel_offices.office_tel as office_tel
,tel_employee.first_name ||tel_employee.family_name as name ,tel_employee.remarks as remarks,
tel_employee_info.Info_text_en,tel_info_types.info_type_desc_en
from tel_employee ,tel_employee_info, tel_info_types, tel_offices
where tel_employee.emp_id=tel_employee_info.emp_id and tel_employee_info.info_type_id=tel_info_types.info_type_id
and tel_employee.emp_office_id=tel_offices.office_id
Union ALL
select null as badge , null as Office, null as office_name , tel_other.city_code as city_code,
tel_other.country_code as country_code ,null as office_tel, tel_other.other_name_en as name , tel_other.remarks as remarks,
tel_other_info.Info_text_en,tel_info_types.info_type_desc_en
from tel_other ,tel_other_info, tel_info_types
where tel_other.other_id=tel_other_info.other_id and tel_other_info.info_type_id=tel_info_types.info_type_id ) ;
|
|
|
|
|
Re: Error in view [message #468020 is a reply to message #467998] |
Wed, 28 July 2010 11:14 |
Amar_bu
Messages: 32 Registered: July 2010 Location: riyadh
|
Member |
|
|
I have two different tables what they have required from me to join them in one view and to make form on it which allow the user to search...when i told them that this can not be done becuase the field are different they told me that i can put where no same fiel select null..Is this is correct
for example
if i want to combine the value of two table employee and other
if i use the following statment
select emp_id as "id", emp_office_id as "office from employee
union all
select other_id as "id" , null as "office" from other ;
Is this is right?
becuase it is give me error corresponding object must have same datatype is there any solution/?
|
|
|
Re: Error in view [message #468023 is a reply to message #468020] |
Wed, 28 July 2010 11:19 |
cookiemonster
Messages: 13938 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Is emp_office_id a number?
null defaults to varchar2
try:
select emp_id as "id", emp_office_id as "office" from employee
union all
select other_id as "id" , to_number(null) as "office" from other ;
And can you have a read of the orafaq forum guide and follow what it says about formatting posts in future please.
|
|
|
|
|
|