= NULL or is NULL : Null Value Compare « Select Query « Oracle PL / SQL






= NULL or is NULL

  
SQL>
SQL> CREATE TABLE DEPT (DEPTNO NUMBER(2),DNAME VARCHAR2(14),LOC VARCHAR2(13) );

Table created.

SQL>
SQL> INSERT INTO DEPT VALUES (10, 'ACCOUNTING', 'NEW YORK');

1 row created.

SQL> INSERT INTO DEPT VALUES (20, 'RESEARCH', 'DALLAS');

1 row created.

SQL> INSERT INTO DEPT VALUES (30, 'SALES', 'CHICAGO');

1 row created.

SQL> INSERT INTO DEPT VALUES (40, 'OPERATIONS', 'BOSTON');

1 row created.

SQL>
SQL> insert into dept ( deptno, dname, loc ) values ( 50, 'IT', NULL );

1 row created.

SQL>
SQL>
SQL> select * from dept where loc = NULL;

no rows selected

SQL> select * from dept where loc IS NULL;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        50 IT

SQL> select * from dept where loc IS NOT NULL;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON

4 rows selected.

SQL>
SQL> drop table dept;

Table dropped.

SQL>

   
  








Related examples in the same category

1.Null value compare
2.is null
3.Using the IS NULL operator
4.IS NULL with NOT operator
5.where null <> null
6.where null=null (does null equal null)
7.Convert null number column to 0
8.Not empty(null)
9.null is null