Collections:
Use NULL as Conditions in Oracle
How To Use NULL as Conditions in Oracle?
✍: FYIcenter.com
If you want to compare values against NULL as conditions, you should use the "IS NULL" or "IS NOT NULL" operator. Do not use "=" or "<>" against NULL. The sample script below shows you some good examples:
SELECT 'A' IS NULL FROM DUAL; -- Error: Boolean is not data type. -- Boolean can only be used as conditions SELECT CASE WHEN 'A' IS NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; FALSE SELECT CASE WHEN '' IS NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; TRUE SELECT CASE WHEN 0 IS NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; FALSE SELECT CASE WHEN NULL IS NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; TRUE SELECT CASE WHEN 'A' = NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; -- Do not use "=" FALSE SELECT CASE WHEN 'A' <> NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; -- Do not use "<>" FALSE SELECT CASE WHEN NULL = NULL THEN 'TRUE' ELSE 'FALSE' END FROM DUAL; -- Do not use "=" FALSE
⇒ Concatenate Two Text Values in Oracle
⇐ What Is NULL Value in Oracle
2019-12-02, 1715🔥, 0💬
Popular Posts:
How To Find Out What Privileges a User Currently Has in Oracle? Privileges granted to users are list...
How To Set Up SQL*Plus Output Format in Oracle? If you want to practice SQL statements with SQL*Plus...
How To Generate CREATE VIEW Script on an Existing View in SQL Server? If you want to know how an exi...
How to change the data type of an existing column with "ALTER TABLE" statements in SQL Server? Somet...
How To Connect ASP Pages to Oracle Servers in Oracle? If you are running Windows IIS Web server and ...