首页 > 其他 > 详细

包和包体简介

时间:2017-09-21 14:28:07      阅读:236      评论:0      收藏:0      [点我收藏+]
包和包体的定义是分开的,
包中存储的是声明,
包体中存储的是存储过程的实现
 
举例:查询某个部门中的所有员工信息  ---> 返回集合
 
包头
 
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;

包和包体简介

原文:http://www.cnblogs.com/anzhi/p/7568256.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!