2012-10-11 34 views
0

我在PL/SQL中加入3個表,員工,部門和其他員工爲管理員。但是,當我運行該腳本PL/SQL - 連接3個表得到含糊不清的錯誤列

Error report: 
ORA-06550: line 19, column 9: 
PL/SQL: ORA-00918: column ambiguously defined 
ORA-06550: line 9, column 3: 
PL/SQL: SQL Statement ignored 
06550. 00000 - "line %s, column %s:\n%s" 
*Cause: Usually a PL/SQL compilation error. 
*Action: 

我在PL/SQL新,因此無法瞭解這些錯誤意味着我得到這個錯誤。

這裏是開始塊內的select語句在那裏我得到的錯誤

select e.first_name||' '||e.last_name AS Employee , 
      m.first_name||' '||m.last_name AS Manager , 
      e.job_id AS jobemp , 
      d.department_name AS Department , 
      e.salary AS Salary 
    into ename, manager, jobid, depn, sal 
    from employees e join departments d 
      on (e.department_id = d.department_id) 
     join employees m 
      on (e.manager_id = m.employee_id) 
    where salary = (select min(salary) from employees) 
    ; 

任何人誰可以幫我鑑定這個錯誤? 在此先感謝。

回答

4

指定哪個表salary來自於你的where子句

select e.first_name||' '||e.last_name AS Employee , 
      m.first_name||' '||m.last_name AS Manager , 
      e.job_id AS jobemp , 
      d.department_name AS Department , 
      e.salary AS Salary 
    into ename, manager, jobid, depn, sal 
    from employees e join departments d 
      on (e.department_id = d.department_id) 
     join employees m 
      on (e.manager_id = m.employee_id) 
    where e.salary = (select min(salary) from employees); 
+0

感謝您的快速響應..現在的工作:) .. – Katherine

+0

是有可能,當我在那裏運行該腳本包括似的東西的表就像它在查詢中的外觀一樣?即使沒有框,它就像是一個列標題,然後在它下面是一個有值的行。 – Katherine

+0

@DianneKatherineDelosReyes eh? – podiluska