What is more efficient, case statement or if elseif etc in PL/SQL
case, conditional-statements, if-statement, plsql
Solution
I guess you are underestimating the query optimizer. In my opinion it's better to concentrate on writing correct and readable sql queries than to micro-optimize things which have a questionable benefit.
In both cases, Oracle will probably do the same operations at execution time.
Problem
examples are: ``` CASE WHEN selector = 'value1' THEN S1; WHEN selector = 'value2' THEN S2; WHEN selector = 'value3' THEN S3; ... ELSE Sn; -- default case END CASE; ``` or another: ``` IF(boolean_expression 1)THEN S1; -- Executes when the boolean expression 1 is true ELSIF( boolean_expression 2) THEN S2; -- Executes when the boolean expression 2 is true ELSIF( boolean_expression 3) THEN S3; -- Executes when the boolean expression 3 is true ELSE S4; -- executes when the none of the above condition is true END IF; ```