如何将逗号分隔的数字字符串拆分为Oracle NUMBER_ARRAY

时间:2016-03-25 10:15:11

标签: arrays oracle

如何将逗号分隔的数字字符串拆分为DBMS_UTILITY.NUMBER_ARRAY?

SET serveroutput on;

declare
l_tablen  BINARY_INTEGER;
l_tab     DBMS_UTILITY.NUMBER_ARRAY;

begin

DBMS_UTILITY.comma_to_table ('1,2,3', l_tablen, l_tab);

FOR i IN 1 .. l_tablen LOOP
    DBMS_OUTPUT.put_line(i || ' : ' || l_tab(i));
END LOOP;

end;

这当然给了我们

PLS-00306: wrong number or types of arguments in call to 'COMMA_TO_TABLE'

1 个答案:

答案 0 :(得分:0)

变量l_tab的类型应为DBMS_UTILITY.UNCL_ARRAY,而不是DBMS_UTILITY.NUMBER_ARRAY。干杯