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.原理 多行 ...
随机推荐
- JS与Jquery的事件委托——解决了绑定相同事件的问题
概念: 什么是事件委托:通俗的讲,事件就是onclick,onmouseover,onmouseout,等就是事件,委托呢,就是让别人来做,这个事件本来是加在某些元素上的,然而你却加到别人身上来做,完 ...
- html常用的标签
很重要的: <form><input><section><option><textarea> <div> 很重要,重要的是相关的 ...
- CoreSeek有符号整型
数据库status字段的值有:-1,0,1 设置过滤字段,发现sql_attr_uint不支持负数,后改用sql_attr_bigint sql_attr_bigint = status sql_at ...
- rxjava各种使用场景
1. 数据的三级缓存 final Observable memory = Observable.create(new Observable.OnSubscribe() { @Override publ ...
- Android BLE开发之Android手机搜索iBeacon基站
本文来自http://blog.csdn.net/hellogv/ ,引用必须注明出处! 上次讲了Android手机与BLE终端之间的通信,而最常见的BLE终端应该是苹果公司倡导的iBeacon基站. ...
- codeforces Gym 100418D BOPC 打表找规律,求逆元
BOPCTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?c ...
- cocos2dx3.2 画图方法小修改之 C++ final学习
今天用cocos2dx 3.2版本号学习画图功能, 于是我重载Node 的draw方法.发现报错, watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQ ...
- android service总结
1.通过startservice方法启动一个服务.service不能自己启动自己.若在一个服务中启动一个activity则,必须是申明一个全新的activity任务TASK.通过startservic ...
- mybatis0212 mybatis逆向工程 (MyBatis Generator)
1mybatis逆向工程 (MyBatis Generator) .1什么是mybatis的逆向工程 mybatis官方为了提高开发效率,提高自动对单表生成sql,包括生成 :mapper.xml.m ...
- Undefined property: Illuminate\Database\Eloquent\Builder
是因为在 $activity=Activity::where('center_id','=',$center->id)->where('Date','=',date("Y-m-d ...