SQL: DECODE Vs. CASE Statement

Опубликовано: 16 Май 2026
на канале: GoLearningPoint
660
5

**DECODE Vs. CASE
Decode is a Function and CASE is a statement.
Decode can only be called in Select statement whereas CASE can be used in PL/SQL Block.
Decode is going to check equality of two or more values whereas CASE can work with equality as well as other operators like less than, greater than, IN, BETWEEN, LIKE etc..
Decode works with scalar values whereas CASE can also work with searchable queries.

Exec Myproc(Case :input when 'True' then 1 Else 0 End);

Exec Myproc(DECODE(:input,'True',1,0);
Case executes much faster than DECODE.

#GoLearningPoint

For Interview questions and other topics -
https://tipsfororacle.blogspot.com/