oracle 拆分字符串
IF length(TRIM(smatlcodes))>0 THEN
starttimes:=1;
sp1:=1;
strArray:=smatlcodes||',';
loop
sp2:=instr(strArray,',',1,starttimes);
mySubStr:=substr(strArray,sp1,sp2-sp1);
sp1:=sp2+1;
starttimes:=starttimes+1;
IF mySubStr IS NOT NULL THEN
--截取
subTemp:=instr(mySubStr,'_',1,1);
subMatl:=subStr(mySubStr,1,subTemp-1);
subFlag:=substr(mySubStr,subTemp+1,1);
strIs:='UPDATE '||v_row.saccount||'.rmdict_matldt a SET sfocusflag='''||subFlag||''' WHERE EXISTS(SELECT * FROM '||v_row.saccount||'.rmdict_matldt b WHERE a.smatlcode=b.smatlcode AND smatlcode='''||subMatl||''')';
--dbms_output.put_line(strIs);
EXECUTE IMMEDIATE strIs;
COMMIT;
END IF;
exit when sp2=0;
end loop;
strArray :='';
END IF;
posted on 2009-08-17 09:39 YWN's blog 阅读(308) 评论(0) 收藏 举报
浙公网安备 33010602011771号