关于oracle中传过来的一个多id需要插入到数据库用,分格的存储过程

create or replace procedure test
(
jf_Id in nvarchar2,
yf_id in nvarchar2
)

as

v_length NUMBER := LENGTH(yf_id);
v_start NUMBER := 1;
v_index NUMBER;

Begin

WHILE(v_start <= v_length)
LOOP
v_index := INSTR(yf_id, ',', v_start);

IF v_index = 0
THEN
dbms_output.put_line(SUBSTR(yf_id, v_start));
v_start := v_length + 1;
ELSE
dbms_output.put_line(SUBSTR(yf_id, v_start, v_index - v_start));
v_start := v_index + 1;
END IF;
END LOOP;

Exception

When others then

Rollback;

End;

原文地址:https://www.cnblogs.com/haofaner/p/5354774.html