Comparing a value with NULL
212595Feb 24 2004 — edited Mar 19 2008Hi,
A funny thing is happening to me. Is it only in oracle 9i or in every version.
I am working on a state project on Data Warehousing and faced a small BUG. Here is the sample code.
DECLARE
v_Var varchar2(10) := 'a';
v_Null varchar2(10) := null;
BEGIN
IF v_Var != v_Null THEN
DBMS_OUTPUT.PUT_LINE('First: Not equal');
ELSE
DBMS_OUTPUT.PUT_LINE('First: Equal');
END IF;
IF v_Var = v_Null THEN
DBMS_OUTPUT.PUT_LINE('Second: Equal');
ELSE
DBMS_OUTPUT.PUT_LINE('Second: Not equal');
END IF;
END;
/
This anonymous block should return Not Equal for both the statements, but unfortunately it returns Equal for the First and Not equal for the Second.
Is this a BUG?
Is this happening only in version 9i (I use version 9.2.0.1.0)?
Any help/suggestion is appreciated.
Thanks! :)
Kamal Vala