为什么变量跟踪器里sqlcode 为0,仍会执行到raise ex_dan,但是又不执行when ex_dan then里的操作
测试传的参数
v_unitstr 'G00009 ', 'G00037 '$ 'G00044 '
v_workno 001W0002
create or replace procedure P_ZDHZ(v_unitstr in varchar2,
v_workno in varchar2,
v_retunum out number,
v_retext out varchar2) is
i int;
str varchar2(5000);
trueunit varchar2(5000);
falseunit varchar2(5000);
v_zdno varchar2(100);
dhrenum number;
dhreerr varchar2(100);
v_buyunit varchar2(100);
v_unit varchar2(100);
v_sql varchar2(5000);
ex_dan EXCEPTION;
begin
trueunit := ' ';
falseunit := ' ';
str := v_unitstr;
i := instr(str, '$ ');
trueunit := trueunit || substr(str, 1, i - 1);
falseunit := falseunit || substr(str, i + 1, LENGTH(str));
if trueunit is not null or trueunit <> ' ' then
p_mkdh( 'ZT ', v_zdno, dhrenum, dhreerr);
if dhreerr = 'ok ' then
select buyunit into v_buyunit from g_workers where workno = v_workno;
if sqlcode != 0 then
v_retunum := -1;
v_retext := '取操作员的单位出错 ' || sqlerrm;
raise ex_dan;
end if;
v_sql:= 'insert into y_zd (primaryn