Oracle_DB_Unix admin/미분류
[TIP] SELECT 절 서브쿼리 사용시 주의점
곰돌곰둘
2015. 10. 8. 16:07
이렇게 수행 시 에러 발생함.
select a.employee_id, a.first_name||' '||a.last_name names, (select b.department_name
from employees a, departments b
where a.department_id = b.department_id) dep_names
from employees a
where a.department_id = 100;
ORA-01427: single-row subquery returns more than one row
01427. 00000 - "single-row subquery returns more than one row"
*Cause:
*Action:
--> 요렇게 고쳐서 수행해야 함
select a.employee_id, a.first_name||' '||a.last_name names, (select b.department_name
from departments b
where a.department_id = b.department_id) dep_names
from employees a
where a.department_id = 100;