--1创建一个存储过程,以员工号为参数,输出该员工的工资。set serveroutput oncreateorreplaceprocedureshow(p_no emp.empno%type)as
v_sal emp.sal%type;beginselect sal into v_sal from emp where empno=p_no;
dbms_output.put_line(v_sal);
exception
when no_data_found then
dbms_output.put_line('there is not such employee');end;/--调用过程beginshow(2010);end;/--2 创建一个存储过程,以员工号为参数,-- 修改该员工的工资。若该员工属于10号部门,-- 则工资增加140元;若属于20号部门,则工资增加200元;-- 若属于30号部门,则工资增加250元;若属于其他部门,则工资增长300元。set serveroutput oncreateorreplaceprocedure show2(p_no emp.empno%type)as
v_dno emp.deptno%type;
v_inc number;beginselect deptno into v_dno from emp where empno=p_no;case v_dno
when10then v_inc:=140;when20then v_inc:=200;when30then v_inc:=250;else v_inc:=300;endcase;update emp set sal=sal+v_inc where empno=p_no;
exception
when no_data_found then
dbms_output.put_line('there is not such an employees');end;/--在调用前后查看一下select sal,empno,deptno from emp where empno=