Oracle PLSQL Demo - 18.02.管道function[查询零散的字段组成list管道返回] [字段必须对上]
--PACKAGE
CREATE OR REPLACE PACKAGE test_141215 is
TYPE type_ref IS record(
ENAME VARCHAR2(20),
SAL NUMBER(10));
TYPE t_type_ref IS TABLE OF type_ref; FUNCTION retrieve(v_name varchar2) RETURN t_type_ref
PIPELINED;
END test_141215; -- PACKAGE BODY
CREATE OR REPLACE PACKAGE BODY test_141215 IS
FUNCTION retrieve(v_name varchar2) RETURN t_type_ref
PIPELINED IS
cur_type_ref type_ref; Type ref_cur_variable IS REF cursor;
cur_variable ref_cur_variable;
--rec_emp type_ref%RowType;
v_sql varchar2(100) := 'select t.ename, t.sal/*, t.empno*/ from scott.emp t';
BEGIN Open cur_variable For v_sql; Loop
fetch cur_variable
InTo cur_type_ref;
Exit When cur_variable%NotFound; dbms_output.put_line(cur_variable%rowcount || ' -> ' || cur_type_ref.ename || ' ' || cur_type_ref.sal);
PIPE ROW(cur_type_ref);
End Loop;
Close cur_variable; RETURN;
END;
END test_141215; --Test retrieve
select * from table(test_141215.retrieve('asd'));
Oracle PLSQL Demo - 18.02.管道function[查询零散的字段组成list管道返回] [字段必须对上]的更多相关文章
- Oracle PLSQL Demo - 18.01管道function[查询零散的字段组成list管道返回]
--PACKAGE CREATE OR REPLACE PACKAGE test_141213 is TYPE type_ref IS record( ENAME ), WORK_CITY ), SA ...
- Oracle PLSQL Demo - 24.分隔字符串function
-- refer: -- http://www.cnblogs.com/gnielee/archive/2009/09/09/1563154.html -- http://www.cnblogs.co ...
- Oracle PLSQL Demo - 19.管道function[查询整表组成list管道返回]
create or replace function function_demo RETURN emp PIPELINED as Type ref_cur_emp IS REF CURSOR RETU ...
- Oracle PLSQL Demo - 29.01.Function结构模板 [无入参] [有返回]
CREATE OR REPLACE FUNCTION function_name RETURN DATE AS v_date DATE; BEGIN ; dbms_output.put_line(v_ ...
- Oracle PLSQL Demo - 20.弱类型REF游标[没有指定查询类型,也不指定返回类型]
declare Type ref_cur_variable IS REF cursor; cur_variable ref_cur_variable; v_ename ); v_deptno ); v ...
- Oracle PLSQL Demo - 17.游标查询个别字段(非整表)
declare Type ref_cur_variable IS REF cursor; cur_variable ref_cur_variable; v_empno scott.emp.empno% ...
- Oracle PLSQL Demo - 16.弱类型REF游标[没有指定查询类型,已指定返回类型]
declare Type ref_cur_variable IS REF cursor; cur_variable ref_cur_variable; rec_emp scott.emp%RowTyp ...
- Oracle PLSQL Demo - 15.强类型REF游标[预先指定查询类型与返回类型]
declare Type ref_cur_emp IS REF CURSOR RETURN scott.emp%RowType; cur_emp ref_cur_emp; rec_emp cur_em ...
- Oracle PLSQL Demo - 02.SELECT INTO单行赋值[SELECT INTO variables]
declare v_sal number; begin ; dbms_output.put_line(v_sal); end;
随机推荐
- Httpclient 4, error 302. How to redirect?
http://stackoverflow.com/questions/3658721/httpclient-4-error-302-how-to-redirect DefaultHttpClient ...
- ElasticSearch异常归纳(能力工场小马哥)
异常1: can not run elasticsearch as root [WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [node-2] ...
- 第14章1节《MonkeyRunner源代码剖析》 HierarchyViewer实现原理-面向控件编程VS面向坐标编程
到此为止我们描写叙述的MonkeyRunner相应用的点击拖放等操作都是直接通过指定坐标点来实现的.比方以下触摸一个坐标点为(60,90)的按钮的脚本样例: 1 device.touch(60,900 ...
- windows安装sqlite
1.下载 sqlite的官方下载地址为http://www.sqlite.org/download.html (sqlite-shell-win32-x86-3090200) 2.将sqlite加入 ...
- use of _track and track_visibility
Dosen't work...the followers don't recieve an email when the state is change. Here is the code in th ...
- Ubuntu Server+openerp
转自:http://www.2cto.com/os/201212/180118.html 今天主要完成OPENERP部署的第一步,安装Ubuntu Server操作系统: 1.将计算机的BIOS设定成 ...
- (原+转)ubuntu16中安装opencv2.4.11(2.4.13)
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5638117.html 参考网址: http://www.cnblogs.com/jeakon/arch ...
- <%@ include file="">和<jsp:include file="">区别
<%@include file="a.jsp"%>是在编译时加入,所谓静态,就是在编译的时候将jsp的代码加入进来再编译,之后运行. <jsp:include p ...
- SpringMVC中的Controller默认单例
众所周知,Servlet是单例的. 在struts中,Action是多例的,每一个请求都会new出来一个action来处理. 在Spring中,Controller默认是单例的,多个请求都会访问同一个 ...
- 使用JavaStcript对数组元素去重的方法
在做javascript开发的时候,经常会遇到数组元素重复的问题,而javascript Array又没有直接提供方法解决此问题,还需要自己去实现. 方案一: 思路: 1.构建一个新的数组存放结果: ...