/*
给员工涨工资,总裁涨1000,经理涨800,其他员工涨400
select empno,job from emp;
update emp set sal= sal + 1000;
判断:
if job = 'PRESIDENT' then update emp set sal= sal + 1000;
注意: 写plsql时,先将可能用到的sql写出
*/
set serveroutput on
declare
pemp_rec emp%rowtype;
pempno emp.empno% TYPE;--员工号
pjob emp.empjob% TYPE; --工种
begin
select * into pemp_rec from emp;
pempno := pemp_rec.empno;
pjob := pempno.empjob;
update emp ....
end;
/
时间: 2024-10-28 08:40:55