Rule plsql:S131 concerns only PL/SQL code not SQL but hit in the both cases

Hi @SebG,

First, CASE expressions.
I don’t see why we should make a distinction between CASE expressions in PL/SQL and CASE expressions in SQL. They both default to NULL if they cannot match any WHEN clause.
The current behavior of plsql:S131 is the same for all CASE expressions: the rule currently raises an issue for all CASE expressions which don’t have an ELSE clause and I believe the rule should never raise an issue on a CASE expression. If you think otherwise, can you please give an example of a CASE expression where the rule should raise an issue? In your examples, the 1st and the 3rd CASE are expressions without an ELSE and, as you explain, Oracle executes the code without any error.

Then, CASE statements.
According to my tests, the current implementation of plsql:S131 does not raise issues in CASE statements. If you found a CASE statement where the rule raised an issue, can you please share an example? In the example you gave, the 2nd CASE is a statement. It contains an ELSE clause, but the current implementation of plsql:S131 doesn’t raise an issue on it even I remove the ELSE clause.
I believe that the rule should raise an issue for all CASE statements which don’t have an ELSE.

I tried to clarify SONARPLSQL-757.