DataGrip
 
Get DataGrip
You are viewing the documentation for an earlier version of DataGrip.

Code Inspection: Using CASE instead of conditional function and vice versa

Last modified: 13 May 2022

Reports situations when CASE and IF are interchangeable.

Example (MySQL):

To keep your code short, you can replace the CASE structure with IF. You can do that by applying the Replace with 'IF' call intention action. The example code will look as follows:

To revert IF to CASE, click IF and apply the Replace with CASE expression intention action.