I would like to update emp table by selecting data from a source table temp0430.

I use this SQL statement:

update emp x
set sal = (select sal from temp0430 y where y.empno=x.empno)
where empno in (select empno from temp0430);

Is this correct? Is there any better way?

SQL> select * from emp

EMPNO ENAME SAL
---------- ---------- -----
7369 SMITH 8888
7499 ALLEN 8888
7521 WARD 8888
7566 JONES 8888
7654 MARTIN 8888
7698 BLAKE 8888
7782 CLARK 8888
7788 SCOTT 8888
7839 KING 8888
7844 TURNER 8888
7876 ADAMS 8888
7900 JAMES 8888
7902 FORD 8888
7934 MILLER 8888

14 rows selected.

SQL> select * from temp0430

EMPNO SAL
---------- ----------
7566 2975
7698 2850
7788 3000
7839 5000
7902 3000

SQL> update emp x
2 set sal = (select sal from temp0430 y where y.empno=x.empno)
3 where empno in (select empno from temp0430);

5 rows updated.

SQL> select * from emp;

EMPNO ENAME SAL
---------- ---------- -------
7369 SMITH 8888
7499 ALLEN 8888
7521 WARD 8888
7566 JONES 2975
7654 MARTIN 8888
7698 BLAKE 2850
7782 CLARK 8888
7788 SCOTT 3000
7839 KING 5000
7844 TURNER 8888
7876 ADAMS 8888
7900 JAMES 8888
7902 FORD 3000
7934 MILLER 8888

14 rows selected.

SQL> commit;