CREATE OR REPLACE FUNCTION decodedim(str IN VARCHAR2, table_id IN NUMBER)
RETURN VARCHAR2
IS
RET VARCHAR2(300);
BEGIN
FOR code_name IN (
select wm_concat(flag_name) INTO RET from(
select flag_name from PU_META_PLAT.MD_META_DIM_CODE where dim_table_id = table_id and flag_code in (
SELECT
trim(substr(',' || str || ',', instr(',' || str || ',', ',', 1, LEVEL)+1,
instr(',' || str || ',', ',', 1, LEVEL + 1)-instr(',' || str || ',', ',', 1, LEVEL)-1))
FROM dual
CONNECT BY LEVEL <= (length(',' || str || ',')-length(replace(',' || str || ',', ',', '')))/1-1
)
)
)
LOOP
DBMS_OUTPUT.put_line(RET);
RETURN RET;
END LOOP;
END;
上面是函数建立的代码,
下面是执行函数:
select decodedim('1,2,3,4,5,6,7,8,25,26,27,28,29,32,33,34,35', 5376) from dual;
不知道为什么结果没有数据,求大神帮忙看看?
慕村9548890
拉丁的传说
冉冉说
相关分类