【存储过程】利用包构建存储过程和存储函数的案例(转)
来源:互联网 发布:淘宝怎么账号登陆 编辑:程序博客网 时间:2024/06/05 15:32
存储过程: 包 create or replace package emppackage is -- Author : ADMINISTRATOR -- Created : 2012-3-22 14:02:43 -- Purpose : 声明一个存储过程 -- Public type declarations type empcursor is ref cursor; -- Public function and procedure declarations --声明一个存储过程 procedure selectEmps(emplist out empcursor); end emppackage; 包体 create or replace package body emppackage is -- Function and procedure implementations procedure selectEmps(emplist out empcursor) is begin open emplist for select * from emp; end; end emppackage; 在命令窗口中调用: declare empc1 emppackage.empcursor; emp_row emp%rowtype; begin emppackage.selectEmps(empc1); loop fetch empc1 into emp_row; exit when empc1%notfound; dbms_output.put_line(emp_row.empno); end loop; close empc1; end; 结果: 2345 7369 7499 7521 存储函数: 包: create or replace package mypackage is -- Author : ADMINISTRATOR -- Created : 2012-3-22 14:06:47 -- Purpose : 存储函数 -- Public type declarations type empc1 is ref cursor; function queryEmps return empc1; end mypackage; 包体: create or replace package body mypackage is function queryEmps return empc1 is emp_c1 empc1; begin open emp_c1 for select * from emp; return emp_c1; end; end mypackage; 在命令窗口中调用: declare emp_c1 mypackage.empc1; emp_row emp%rowtype; begin emp_c1:=mypackage.queryEmps; loop fetch emp_c1 into emp_row; exit when emp_c1%notfound; dbms_output.put_line(emp_row.empno); end loop; close emp_c1; end; 结果: 2345 7369 7499 7521
0 0
- 【存储过程】利用包构建存储过程和存储函数的案例(转)
- 利用包构建存储过程和存储函数的案例
- MYSQL 存储过程和函数 案例 例子
- 包和存储过程
- 存储过程和包
- 存储过程和存储函数
- 存储函数和存储过程
- 存储过程和存储函数
- 存储过程和存储函数
- 存储过程和存储函数的区别
- oracle的存储过程和存储函数
- mysql的存储函数和存储过程
- oracle 创建,删除存储过程,参数传递,创建,删除存储函数,存储过程和函数的查看,包,系统包
- oracle 创建,删除存储过程,参数传递,创建,删除存储函数,存储过程和函数的查看,包,系统包
- oracle 创建,删除存储过程,参数传递,创建,删除存储函数,存储过程和函数的查看,包,系统包
- oracle 创建,删除存储过程,参数传递,创建,删除存储函数,存储过程和函数的查看,包,系统包
- oracle 创建,删除存储过程,参数传递,创建,删除存储函数,存储过程和函数的查看,包,系统包
- oracle 创建,删除存储过程,参数传递,创建,删除存储函数,存储过程和函数的查看,包,系统包
- linux下python链接mongodb
- php递归使用示例(php递归函数)
- 如何搞定你的直接上司
- 根据“年月日”字符串,判断这一天是星期几
- 算法的时间复杂度和空间复杂度
- 【存储过程】利用包构建存储过程和存储函数的案例(转)
- MLeaksFinder:精准 iOS 内存泄露检测工具
- 对比:UIButton创建方法
- Google cardBoard Android API (四):Constants
- iOS开发中三种简单的动画
- 安装Nginx
- Launcher2 断电重启主界面加载失败/安装第三方应用/卸载应用主界面加载失败
- CDHtmlDialog探索----WebBrowser扩展和网页Javascript错误处理
- 代码解析深度学习系统编程模型:TensorFlow vs. CNTK