码迷,mamicode.com
首页 > 数据库 > 详细

Oracle反向字符截取逗號分隔字符串

时间:2016-04-07 09:29:15      阅读:295      评论:0      收藏:0      [点我收藏+]

标签:

DECLARE
M VARCHAR(10);
BEGIN
FOR I IN (
WITH T AS
 (SELECT REVERSE(i,am,a,test,hahahhah) AS STR FROM DUAL)
SELECT LEVEL,
       REGEXP_SUBSTR(T.STR, [^,]+, 1, LEVEL) STR_SINGLE
  FROM T
CONNECT BY LEVEL <= LENGTH(T.STR) - LENGTH(REPLACE(T.STR, ,, ‘‘)) + 1)
LOOP
  SELECT REVERSE(I.STR_SINGLE) INTO M FROM DUAL;
 DBMS_OUTPUT.PUT_LINE(M);
END LOOP; 
END;

使用 REVERSE()函數反轉子串。

Oracle反向字符截取逗號分隔字符串

标签:

原文地址:http://www.cnblogs.com/kuangxiangnice/p/5362084.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!