我必须进行大规模更新。所以我写了一个程序。
CREATE OR REPLACE PROCEDURE or_doh_rcause_sm_wip_upd_sp (
p_rcause_cd VARCHAR2,
p_doh_sa clob
)
IS
v_plant_cd VARCHAR2 (8);
v_doh_sa NUMBER := 0;
v_ins_upd CHAR(1);
Begin
for i in (select regexp_substr( p_doh_sa, '[^;]+', 1, rownum) result
from dual
connect by level <= length(regexp_replace( p_doh_sa, '[^;]+')) + 1)
LOOP
v_doh_sa := TO_NUMBER(substr( i.result||',', 1, instr(i.result,',')-1 ),'9999999999999999999') ;
v_ins_upd := substr(i.result, instr(i.result,',',1)+1,1);
v_plant_cd := substr( i.result,instr(i.result,',',1,2)+1 );
IF v_ins_upd = 'U' THEN
update OR_DOH_PM_SM_ROOT_CAUSE_T set ROOT_CAUSE_SA = p_rcause_cd
where DOH_SA = v_doh_sa
AND Plant_cd = v_plant_cd;
END IF;
END LOOP;
END;
例如:p_doh_sa:'942168,I,FV52;942167,I,FV52;';
像这样,我将拥有 500 多套。如果他们从前端运行
出错ORA-01460: unimplemented or unreasonable conversion requested
请让我知道如何解决这个问题。