Introduction

A newly initialized variable is always equal to NULL unless you assign a default value.

An empty string '' is also interpreted as NULL.

NULL is neither equal nor unequal to any non-NULL value.

It is unequal to itself.

Demo

SQL>
SQL> declare-- from  ww w.  j  a v a 2 s . co  m
  2       v_nr NUMBER;
  3  begin
  4       if v_nr = 1 then
  5
  6          DBMS_OUTPUT.put_line('Equal to 1');
  7      elsif v_nr!= 1 then
  8          DBMS_OUTPUT.put_line('Not equal to 1');
  9      elsif v_nr = v_nr then
 10          DBMS_OUTPUT.put_line('Equal to itself');
 11      else
 12          DBMS_OUTPUT.put_line('Undefined result');
 13      end if;
 14      v_nr:=v_nr+1;
 15      DBMS_OUTPUT.put_line('New value: <'||v_nr||'>');
 16  end;
 17  /
Undefined result
New value: <>

PL/SQL procedure successfully completed.

SQL>

Related Topic