定义两个变量str和v_value,v_1... str = '109,108,109,114,116,120,2301,2302';if instr(str,',')=0 then v_1 := substr(str,0,instr(str,',')-1); v_value := substr(str,instr(str,',')+1); end if; if instr(v_value ,',')=0 then v_2 := substr(v_value,0,instr(v_value,',')-1); v_value := substr(v_value,instr(v_value,',')+1); end if;.. .. .. 实现分割
procedure EntryLog_GetProgramID(pProgramCode in varchar2, cur_OUT OUT RefCursor) AS v_1 varchar2(20); v_value varchar2(20); begin if instr(pProgramCode,',')=0 then v_1 := substr(pProgramCode,0,instr(pProgramCode,',')-1); v_value := substr(pProgramCode,instr(pProgramCode,',')+1); end if; open cur_OUT for select * from "Program" where "ProgramCode" in (pProgramCode); end EntryLog_GetProgramID; 看我这样写对吗,其中pProgramCode就是要分割的字符串
str = '109,108,109,114,116,120,2301,2302';if instr(str,',')=0 then
v_1 := substr(str,0,instr(str,',')-1);
v_value := substr(str,instr(str,',')+1);
end if;
if instr(v_value ,',')=0 then
v_2 := substr(v_value,0,instr(v_value,',')-1);
v_value := substr(v_value,instr(v_value,',')+1);
end if;..
..
..
实现分割
AS
v_1 varchar2(20);
v_value varchar2(20);
begin
if instr(pProgramCode,',')=0 then
v_1 := substr(pProgramCode,0,instr(pProgramCode,',')-1);
v_value := substr(pProgramCode,instr(pProgramCode,',')+1);
end if;
open cur_OUT for
select *
from "Program"
where
"ProgramCode" in (pProgramCode);
end EntryLog_GetProgramID;
看我这样写对吗,其中pProgramCode就是要分割的字符串