2014-01-08 57 views
0

我正在創建新的觸發器,並希望在new.SCO_NUMBER驗證中同時具有空值和空字符串。我在使用兩者時出錯(如下所示),但當我使用':new.SCO_NUMBER IS NULL'時,它工作正常。如何使用或在此驗證。在觸發條件中插入空值和字符串'Null

CREATE OR REPLACE TRIGGER TRIG_SCONUMBER_INSERT AFTER 
    INSERT ON S_SYN_EAI_SCO_IN FOR EACH row DECLARE XYZ BEGIN XYZ 
    SELECT XYZ 
    FROM xyz 
    WHERE xyz IF inserting 
    AND :new.SCO_NUMBER IS (NULL 
    OR 'NULL') THEN varError_Msg := 'SCO Number cannot be NULL in'; 
    varError_id     := 1; 
    varSucceeded     := 'N' ; 
    varErrorExists    :=1; 
END IF; 

回答

0

在T-SQL的情況下,

new.SCO_NUMBER IS NULL OR new.SCO_NUMBER = 'NULL'取代new.SCO_NUMBER IS (NULL OR 'NULL')。這應該適合你。

+0

謝謝大家,它正在工作 –

+0

@PulkitBhatia請投票如果您發現它有用! :) –

+0

沒有要求。聲譽:) –

0

試試這個

IF inserting 
    AND (:new.SCO_NUMBER IS NULL 
    OR :new.SCO_NUMBER = 'NULL') THEN 
0

試試這個,

(:new.SCO_NUMBER IS NULL OR :new.SCO_NUMBER = 'NULL')