已上图为例
先以逗号分隔拆分
拆分函数:
CREATE OR REPLACE FUNCTION SPLIT(P_STRING VARCHAR2, P_SEP VARCHAR2 := ',') RETURN TYPE_SPLIT PIPELINED IS IDX PLS_INTEGER; V_STRING VARCHAR2(4000) := P_STRING; BEGIN LOOP IDX := INSTR(V_STRING, P_SEP); IF IDX > 0 THEN PIPE ROW(SUBSTR(V_STRING, 1, IDX - 1)); V_STRING := SUBSTR(V_STRING, IDX + LENGTH(P_SEP)); ELSE PIPE ROW(V_STRING); EXIT; END IF; END LOOP; END;
下面是sql语言:
select * from(select d.news_id,d.hot_tag_name from news_data d where d.news_id=101166699) t,table(split(t.hot_tag_name, ',')) t1
执行效果:
现在人工智能非常火爆,很多朋友都想学,但是一般的教程都是为博硕生准备的,太难看懂了。最近发现了一个非常适合小白入门的教程,不仅通俗易懂而且还很风趣幽默。所以忍不住分享一下给大家