oracle储存过程中,if条件为某变量不等于1,怎么写

2025-03-22 16:55:38
推荐回答(3个)
回答1:

oracle存储过程中的if条件判断的写法:
比如:
temp varchar2(10) := '10000';
if temp <> '10000' then
insert into ...
else
update .......

end if;

回答2:

用plsql developer调试下,看看v_storeid520的值是多少,有没有执行update;
或者在 if then end if; 中加上dbms_output打印下,例如:
if v_storeid520 <>1 then
v_sql := 'update ' || v_userinfo.aorgalias ||
'.tab520 t set t.nbyj=''' || v_nbyj ||
''' Where t.StoreID = '||v_storeid520||' ';
execute immediate v_sql;
dbms_output.putline('执行update语句,语句SQL:||v_sql||chr(10)||变量v_storeid520的值为'||v_storeid520);
end if;

回答3:

应该是这样写 的啊,哪你调试一下,看到底v_storeid520等于几。就知道是怎么回事了