在oracle中使用update更新数据。
1,使用表达式更新数据
update table set column1 = value1,colunm2 = value2 where condition
update emp set sal = 1900 where ename = 'SCOTT'
select sal from emp where ename = 'SCOTT'
update emp set sal = 1800,comm = 234 where ename = 'SCOTT'
select ename,sal,comm from emp where ename = 'SCOTT'
select empno,ename,hiredate from emp where empno = 7788
update emp set hiredate = to_date('1984/01/01','YYYY/MM/DD') where empno =7788
select empno,ename,hiredate from emp where empno = 7788
2,使用子查询更新数据
update emp set comm = 200 where ename = 'SMITH'
select job,sal,comm from emp where ename = 'SMITH'
update emp set job = 'CLERK',sal = 2200,comm = 200 where ename = 'SCOTT'
update emp set (job,sal,comm) = (select job,sal,comm from emp where ename = 'SMITH')where ename = 'SCOTT'
select ename,job,sal,comm from emp where ename = 'SCOTT'