为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】: DM8
【操作系统】:Linux
【CPU】: Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz
【问题描述】*:
存储过程调用存储过程,出参未被清空
/*测试出参 在oracle期待输出为空 但是达梦会出现error*/
create or replace procedure testKinstarerOutParam(str OUT varchar2) as
begin
dbms_output.put_line('str = ' || str);
if (str is not null) THEN
RAISE_APPLICATION_ERROR(-20001, '出参没有清空');
end if;
end;
/
create or replace procedure testKinstarerCallOutParam as
strIn varchar2(64) := 'error';
begin
testKinstarerOutParam(strIn);
end;
/
dbms_output.enable;
begin testKinstarerCallOutParam(); end;
在达梦中会抛出-20001: 出参没有清空,Oracle中却没有这个问题。
现在的解决方案就是在每一个存储过程调用存储过程的地方把OUT的参数都赋值为空或者null,这样逻辑才能和Oracle下面一致。
或者请问下有没有什么方法,可以在所有调存储过程被调用之前,清空出参,提供一个这样的切面。
在Oracle中会输出str= ,testKinstarerOutParam(str OUT varchar2) str被定义为出参,不会被赋值,达梦中出参str被赋值了str=strIn='error'
testKinstarerCallOutParam这个存储过程中已经定义了strIn=error,执行testKinstarerOutParam(strIn)过程的时候str=error 不就满足了if (str is not null)条件吗,非空则报错