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, 1616🔥, 0💬
Popular Posts:
What Are the Underflow and Overflow Behaviors on FLOAT Literals in SQL Server Transact-SQL? If you e...
What Is the Difference Between GETDATE() and GETUTCDATE() in SQL Server Transact-SQL? The difference...
How to set database to be READ_ONLY in SQL Server? Databases in SQL Server have two update options: ...
How To Get the Definition of a Stored Procedure Back in SQL Server Transact-SQL? If you want get the...
What Happens to Your Transactions When ERROR 1205 Occurred in MySQL? If your transaction receives th...