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

decode(null,null,'true','false') = 'true'?

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

Problem

Today my database world was shattered.

For my whole lifetime I thought, comparing with a null value in Oracle results in the "false-case".

But not so for the decode function.

Anybody know, what's the idea behind this?

Solution

DECODE


In a DECODE function, Oracle considers two nulls to be equivalent. If expr is null, then Oracle returns the result of the first search that is also null.

Context

StackExchange Database Administrators Q#148887, answer score: 4

Revisions (0)

No revisions yet.