drop table t1 purge;

  create table t1 as select * from emp;


  update t1

  set sal = sal + 1000, comm = nvl(comm, 0) + 100

  where deptno=30;




 - 서브쿼리를 이용한 update


  update t1

  set (sal, comm) = (sal + 100, nvl(comm, 0) + 10)

  where deptno = 10;

set (sal, comm) = (sal + 100, nvl(comm, 0) + 10)

                   *

ERROR at line 2:

ORA-01767: UPDATE ... SET expression must be a subquery



↓ ↓ ↓


  update t1

  set (sal, comm) = (select sal, comm from emp where ename = 'ALLEN')

  where deptno = 10;



 

  * implicit query --> http://goo.gl/QPFrI

: is a component of a DML statement that retrieves data without using a subquery.

+ Recent posts