CREATE TABLE testtab ( label VARCHAR(30) PRIMARY KEY, a VARCHAR(10), b VARCHAR(10) ); INSERT INTO testtab VALUES('both null',NULL,NULL); INSERT INTO testtab VALUES('a null',NULL,'b not null'); INSERT INTO testtab VALUES('b empty string','a',''); INSERT INTO testtab VALUES('a null, b empty string',NULL,''); INSERT INTO testtab VALUES('equal non-empty strings','x','x'); INSERT INTO testtab VALUES('non-equal non-empty strings','x','y'); SELECT * FROM testtab; SELECT * FROM testtab WHERE a=b; SELECT * FROM testtab WHERE a<>b; SELECT * FROM testtab WHERE b IS NULL; SELECT * FROM testtab WHERE b IS NOT NULL; Table dropped. SQL> 2 3 4 5 Table created. SQL> 1 row created. SQL> 1 row created. SQL> 1 row created. SQL> 1 row created. SQL> 1 row created. SQL> 1 row created. SQL> LABEL A B ------------------------------ ---------- ---------- both null a null b not null b empty string a a null, b empty string equal non-empty strings x x non-equal non-empty strings x y 6 rows selected. SQL> LABEL A B ------------------------------ ---------- ---------- equal non-empty strings x x SQL> LABEL A B ------------------------------ ---------- ---------- non-equal non-empty strings x y SQL> LABEL A B ------------------------------ ---------- ---------- both null b empty string a a null, b empty string SQL> LABEL A B ------------------------------ ---------- ---------- a null b not null equal non-empty strings x x non-equal non-empty strings x y