我对Oracle存储过程开发并不熟悉,我在Oracle 12C版本中面临布尔变量初始化的问题,同样的代码在Oracle 11G中运行良好。如果有问题,请你帮我确定问题。
来自商店程序的一段代码:
IF v_Delivery_End_Dttm IS NULL THEN
IF v_Spl_Instr_Code_1 = 'L' THEN
g_Launch_Orders := TRUE;
ELSIF v_Spl_Instr_Code_1 IS NULL THEN
g_Regular_Orders := TRUE;
END IF;
ELSIF (v_Delivery_End_Dttm IS NOT NULL AND ( v_Spl_Instr_Code_1 = 'L' OR v_Spl_Instr_Code_1 IS NULL )) THEN
g_CRDD_Orders := TRUE;
END IF;
Input Values:- are
v_Delivery_End_Dttm is nulll
v_Spl_Instr_Code_1 is null
g_Launch_Orders, g_Regular_Orders, g_CRDD_Orders are global variables and they are initialized to FALSE in Packed Body Variable initailization part.
And the global variables are initialized to TRUE in only above mentioned code.
In Oracle 12C at a time two globales are becoming TRUE, and that to doesn't happen all the time, For the same data it initialized properly at some time and it doesn't at some other time.
From the above example i have the output as below
g_Launch_Orders = FALSE
g_Regular_Orders = TRUE
g_CRDD_Orders = TRUE
理想情况下,我应该只有g_Regular_Orders变为TRUE,但g_CRDD_Orders也被初始化为TRUE。这只发生在ORACLE 12C中,它在ORACLE 11G中运行良好。
如果您在上面的代码中发现任何错误或ORACLE12C中有任何错误,请告诉我。
顺便说一句,我从Java调用Stored过程
任何帮助都很适用
谢谢, 拉玛克里希
答案 0 :(得分:0)
在没有初始化部分的情况下,不可能说出你的代码有什么问题。为了确保变量具有您需要的值,请对其进行初始化:
procedure my_proc(....) is
my_bool1 boolean := true; -- this variable will have value "TRUE"
my_bool2 boolean := false; -- this variable will have value "FALSE"
begin
...
end;
此代码在oracle版本中的工作方式相同。