包和包体简介

包和包体的定义是分开的,
包中存储的是声明,
包体中存储的是存储过程的实现
 
举例:查询某个部门中的所有员工信息  ---> 返回集合
 
包头
 
CREATE OR REPLACE PACKAGE MYPACKAGE AS
 
  type empcursor is ref cursor; //自定义一个集合类型
  procedure queryEmpList(dno in number,empList out empcursor);
 
END MYPACKAGE;
 
 
包体
CREATE OR REPLACE PACKAGE BODY MYPACKAGE AS
               //将集合类型的参数作为out参数传入
  procedure queryEmpList(dno in number,empList out empcursor) AS
  BEGIN
 
    open empList for select * from emp where deptno=dno;
 
  END queryEmpList;
 
END MYPACKAGE;
原文地址:https://www.cnblogs.com/anzhi/p/7568256.html