title: UPDATE and EXISTS Clause
body: <p>Please help me identify what I am doing wrong in the query below :</p>
  
  <p><strong>The following code gives an error: ORA-00904 : DPT.DEPTNO : invalid identifier</strong></p>
  
  <pre><code>UPDATE emp1 
  SET ename = (SELECT dname
  FROM dpt 
  WHERE dpt.deptno = emp1.deptno)
  WHERE EXISTS (SELECT ename
  FROM emp1 
  WHERE emp1.deptno = dpt.deptno);
  </code></pre>
  
  <p>the first half of the query works fine on its own :</p>
  
  <pre><code>UPDATE emp1 
  SET ename = (SELECT dname
  FROM dpt 
  WHERE dpt.deptno = emp1.deptno)
  </code></pre>