Oracle

How to use dummy column?

Figo Kim 2006. 9. 1. 22:40
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
select 
department_id,TO_NUMBER(null) location, hire_date
from employees
union
select
department_id, location_id, TO_DATE(null) hired
from departments


In this example, the name location is given as the dummy column heading. The TO_NUMBER function is used in the first query to match the NUMBER data type of the LOCATION_ID column retrieved by the second query. Similary, the TO_DATE function in the second query is used to match the DATE data type of the HIRE_DATE column retrieved by the first query.



select
employee_id,job_id,salary
from
employees
union
select
employee_id,job_id,0
from
job_history;
Or, you can use this way.

'Oracle' 카테고리의 다른 글

Controlling the Order of Rows  (0) 2006.09.01
How to use dummy column?  (0) 2006.09.01
Set Operator Sample.  (0) 2006.09.01
Set Operator Sample.  (0) 2006.09.01
Multiple operator..  (0) 2006.09.01