簡體   English   中英

Oracle 12C布爾變量初始化問題

[英]Oracle 12C boolean Variable initialization issue

我對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調用存儲過程

任何幫助都值得贊賞

謝謝,羅摩克里希納

沒有初始化部分,就不可能說代碼出了什么問題。 為確保變量具有所需的值,請對其進行初始化:

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版本中,此代碼將以相同的方式工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM