CASE cannot be an instruction without a WHEN clause

Software ResiliencyProgramming Best Practices

Why you should care

The PLSQL CASE has similar functionality of an IF-THEN-ELSE statement. The CASE statement evaluates a single expression and expresses it against several potential values or evaluates Boolean Values while choosing the first one that is TRUE.
WHEN clauses are executed in order. WHEN clauses is executed only once. Without a WHEN clause the CASE statement generally does not end, or not fully executed causing errors.

Business Impacts

It is recommended to have CASE be utilized with a WHEN clause so that there are less risks in the code and is more productive.

Production Risk
5362

CAST Recommendations

References

https://docs.oracle.com/cd/E19159-01/819-3669/bnalq/index.html

Style Guide

How we detect

This code insight shows that each case instruction should have a default clause.

5362

About CAST and Highlight’s Code Insights

Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.

See featuresHow it works