接下来创建存储过程:create or replace procedure pro_emp1 (empnum emp.empno%type ,empsal out emp.sal%type) as begin select sal*12+nvl(comm,0) into empsal from emp where empno = empnum; end;这里是计算指定员工的年薪,通过传入员工编号得到年薪(基本类型).--------------------------------------------------------------------------------------------------------------------create or replace procedure pro_emp2 (deptnum emp.deptno%type ,rs out Sys_Refcursor) as begin open rs for select * from emp where deptno = deptnum; end;这里是通过部门编号查找部门成员,返回的是一个游标,注意游标用Sys_Refcursor封装接下来是重点,在dao包中创建EmpDao:public interface EmpDao {
@Options(statementType = StatementType.CALLABLE) //这里选择CALLABLE表示调用存储过程
@Select("{call pro_emp1 (#{empnum,mode=IN,jdbcType=INTEGER},#{empsal,mode=OUT,jdbcType=DOUBLE})}") //这里mode=OUT表示输出参数 public void callPro_emp1(Map<String ,Object> prama); //返回一个基本类型可以不用返回值,返回的基本类型被封装到传入的Map中