rwhn.net
当前位置:首页 >> ORACLE 怎么拆分字符串 >>

ORACLE 怎么拆分字符串

(1)定义split_type类型: CREATE OR REPLACE TYPE split_type IS TABLE OF VARCHAR2 (4000) / (2)定义split函数: CREATE OR REPLACE FUNCTION split (p_str IN VARCHAR2, p_delimiter IN VARCHAR2) RETURN split_type IS j INT := 0; i INT...

SELECT REGEXP_SUBSTR('奥迪-A5-Coupe Qu-2.0T-7档自动-两门四驱-西拉红-深内饰', '[^-]+', 1, LEVEL, 'i') AS STR FROM DUAL CONNECT BY LEVEL

代码如下: CREATE OR REPLACE TYPE str_split IS TABLE OF VARCHAR2 (4000); CREATE OR REPLACE FUNCTION splitstr(p_string IN VARCHAR2, p_delimiter IN VARCHAR2) RETURN str_split PIPELINED AS v_length NUMBER := LENGTH(p_string); v_st...

oracle 中可以用connect by把字符串按都好分割: 比如定义字符串: pv_no_list :='23,34,45,56'; SELECT DISTINCT REGEXP_SUBSTR (pv_no_list,'[^,]+',1,LEVEL) as "token" FROM DUAL CONNECT BY REGEXP_SUBSTR (pv_no_list,'[^,]+',1,LEVEL) IS...

创建测试表 create table tb(col1 varchar2(10),col2 varchar2(100));insert into tb values ('TEST1','C749,C153,C154,C155,C158,C183,C240');运行 select col1,substr(t.ca,instr(t.ca, ',', 1, c.lv) + 1,instr(t.ca, ',', 1, c.lv + 1) - (i...

with temp as ( select name as text from a ) select substr(text,instr(text,',',1,rn)+1,instr(text,',',1,rn+1)-instr(text,',',1,rn)-1) text from ( select ','||t1.text||',' text,t2.rn from (select text,length(text)-length(replace(...

这是json串,和数据库没有关系,如果纯粹的字符串拼接用 ||

给你个存储过程 CREATE PROCEDURE p_split @c varchar(8000), @split varchar(5) as declare @t table( word varchar(20) ) begin while(charindex(@split,@c)0) begin insert @t( word) values (substring(@c,1,charindex(@split,@c)-1)) set @...

需要用wm_concat函数来实现。 如目前在emp表中查询数据如下: 要按照deptno相同的将ename以字符串形式合并,可用如下语句: select deptno,wm_concat(ename) from emp group by deptno;查询结果:

oracle 中可以用connect by把字符串按都好分割: 比如定义字符串: pv_no_list :='23,34,45,56'; SELECT DISTINCT REGEXP_SUBSTR (pv_no_list,'[^,]+',1,LEVEL) as "token" FROM DUAL CONNECT BY REGEXP_SUBSTR (pv_no_list,'[^,]+',1,LEVEL) IS...

网站首页 | 网站地图
All rights reserved Powered by www.rwhn.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com