HiveBrain v1.2.0
Get Started
← Back to all entries
gotchaModerate

Why does = NULL not work in Oracle?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
whynullworkdoesoraclenot

Problem

I recently realized that we need to use a special syntax IS NULL to compare a literal to NULL.

Why does = NULL not work here?

Solution

Take a look at PSOUG's notes on NULL. As Fabricio Araujo hinted, NULL is not really a value like the number 4 or string 'bacon strips'. In fact, NULL is untyped in the SQL language, which is why you cannot validly use it in an equality comparison. You need the special IS [NOT] NULL syntax to check if a value is NULL or not.

Context

StackExchange Database Administrators Q#4291, answer score: 13

Revisions (0)

No revisions yet.