SQL: DECODE Vs. CASE Statement

Details
Title | SQL: DECODE Vs. CASE Statement |
Author | GoLearningPoint |
Duration | 7:06 |
File Format | MP3 / MP4 |
Original URL | https://youtube.com/watch?v=VNSUmYJJqU4 |
Description
**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/