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

Home
Oracle PL / SQL
1.Aggregate Functions
2.Analytical Functions
3.Char Functions
4.Constraints
5.Conversion Functions
6.Cursor
7.Data Type
8.Date Timezone
9.Hierarchical Query
10.Index
11.Insert Delete Update
12.Large Objects
13.Numeric Math Functions
14.Object Oriented Database
15.PL SQL
16.Regular Expressions
17.Report Column Page
18.Result Set
19.Select Query
20.Sequence
21.SQL Plus
22.Stored Procedure Function
23.Subquery
24.System Packages
25.System Tables Views
26.Table
27.Table Joins
28.Trigger
29.User Previliege
30.View
31.XML
Oracle PL / SQL » Select Query » Null Value Compare 
= 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');

row created.

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

row created.

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

row created.

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

row created.

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

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

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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.