ORACLE之PACKAGE-游标变量
刚学pl/sql编程,写了两个package。pkg_temp_fn31和pkg_temp_fn32。内容涉及pl/sql基本语法,游标变量,存储过程(in,out)。
pkg_temp_fn31调用pkg_temp_fn32,pkg_temp_fn32中定义了out游标变量。
- pkg_temp_fn31内有一个procedure test(p_mapid number)
创建包规范
create or replace package pkg_temp_fn31 is --25-03-2016 procedure test(p_mapid number); end pkg_temp_fn31; --exec pkg_temp_fn31(&p_mapid);执行此包
创建包规范
create or replace package body pkg_temp_fn31 is procedure test(p_mapid number) is p_cursor pkg_temp_fn32.ref_cursor;-- p_personno t_fn_person.person_code%type; p_personname t_fn_person.person_name%type; begin pkg_temp_fn32.queryall(p_mapid,p_cursor);-- loop fetch p_cursor into p_personno,p_personname; exit when p_cursor%notfound; dbms_output.put_line(p_personno||'''s person name is '||p_personname); end loop; end test; end pkg_temp_fn31;
- kg_temp_fn2内有一个procedure queryall(pmap_id number ,p_cursor out ref_cursor)
创建包规范
create or replace package pkg_temp_fn32 is --25/03/2016 type ref_cursor is ref cursor;-- procedure queryall(pmap_id number ,p_cursor out ref_cursor); end pkg_temp_fn32;
创建包规范
create or replace package body pkg_temp_fn32 is procedure queryall(pmap_id number ,p_cursor out ref_cursor) is RF pkg_temp_fn32.ref_cursor; begin open RF for select x.person_code,x.person_name from t_fn_person x where x.map_id=pmap_id; p_cursor:=RF; end queryall; end pkg_temp_fn32;
执行结果:
ORACLE之PACKAGE-游标变量的更多相关文章
- Oracle PLSQL游标、游标变量的使用
参考文章:https://www.cnblogs.com/huyong/archive/2011/05/04/2036377.html 在 PL/SQL 程序中,对于处理多行记录的事务经常使用游标来实 ...
- (转)oracle 存储过程 带游标作为OUT参数输出
(转)oracle 存储过程 带游标作为OUT参数输出 存储过程返回OUT参数的游标 例子. 包中带过程 要自己定义一个type [cur_name] is ref cursor游标,返回的时候就直接 ...
- oracle存储过程、声明变量、for循环|转|
oracle存储过程.声明变量.for循环 1.创建存储过程 create or replace procedure test(var_name_1 in type,var_name_2 out ty ...
- oracle存储过程、声明变量、for循环(转)
oracle存储过程.声明变量.for循环 1.创建存储过程 create or replace procedure test(var_name_1 in type,var_name_2 out ty ...
- 公司需求知识自学-Oracle的Package的作用及用法
Oracle的Package的作用 简化应用设计.提高应用性能.实现信息隐藏.子程序重载. 1.Oracle的Package除 了把存储过程放到一堆儿以外还有没有其他的作用(好处)? 你不觉得把存储过 ...
- [转]oracle存储过程、声明变量、for循环
oracle存储过程.声明变量.for循环 1.创建存储过程 create or replace procedure test(var_name_1 in type,var_name_2 out ty ...
- oracle存储过程、声明变量、for循环
oracle存储过程.声明变量.for循环 1.创建存储过程 create or replace procedure test(var_name_1 in type,var_name_2 out t ...
- oracle 中的游标
oracle 中的游标 通俗易懂的sql代码直接上! --简单的游标使用滴呀 --使用FOR OBJ IN OBJS LOOP ......END LOOP; DECLARE CURSOR C_JOB ...
- Oracle系列之游标
涉及到表的处理请参看原表结构与数据 Oracle建表插数据等等 游标: 1.目的 解决“ select * ”返回空.多行记录问题 但凡select,就可能多行结果集,也就需要用游标 2.原理 多行 ...
随机推荐
- [iOS UI进阶 - 2.1] 彩票Demo v1.1
A.需求 1.优化项目设置 2.自定义导航栏标题按钮 3.多版本处理 4.iOS6和iOS7的适配 5.设置按钮背景 6.设置值UIBarButtonItem样式 code source: htt ...
- ASP.NET(C#)中的try catch异常处理机制
在开发一个Umbraco平台系统的过程中,遇到了问题. 写的代码如下 fileUrl = MediaHelper.GetMediaUrl(Convert.ToInt32(publishedConten ...
- MFC 应用、模板、框架、文档、视图 的关系
从该对象 如何访问其他对象 全局函数 调用全局函数AfxGetApp可以得到CWinApp应用类指针 应用 AfxGetApp()->m_pMainWnd为框架窗口指针:用CWinApp::Ge ...
- Nginx端口的修改
修改 nginx.conf 文件实现.在 Linux 上该文件的路径为 /usr/local/nginx/conf/nginx.conf,Windows 下 安装目录\conf\nginx.conf. ...
- js 限定上传文件大小 类型
方案1 :限定大小 <html> <head> <script type="text/javascript"> var isIE = /ms ...
- CSMA/CD协议——学习笔记
CSMA/CD协议要点: 1)适配器从网络层获得一个分组,加上以太网的首部和尾部,组成以太网帧,放入适配器的缓存中,准备发送. 2)若适配器检测到信道空闲(即在96比特时间内没有检测到信道上有信号), ...
- MEF 编程指南(三):声明导出
组合部件通过 [System.ComponentModel.Composition.ExportAttribute] 特性声明导出.MEF 有几种不同的方式声明导出,包括在部件层面(Part Leve ...
- google域名邮箱申请 gmail域名邮箱申请(企业应用套件)指南
近期一直有朋友问我怎么注冊域名邮箱,于是整理出来,贴出来吧.已经非常具体了,你能够直接对比着做了.什么是域名邮箱? 假设你有一个自己的域名,通过对域名dns进行设置,创建以自己的域名作为邮箱后缀的邮箱 ...
- char指针
1.在C语言中,没有字符串类型,因此使用char指针表示字符串. 2.那么问题来了,使用char* 表示字符串,到哪里是结尾呢?因此需要一个特殊的字符作为哨兵,类似迭代器中的end(),这个哨兵就是' ...
- [AngularJS] Directive using another directive by 'require'
Directive can use another directive though 'require' keyword. angular.module('docsTabsExample', []) ...