DataGrip 2021.2 Help

Code Inspection: Unreachable code

Reports unreachable statements inside SQL routines.

Example (Microsoft SQL Server):

CREATE FUNCTION foo() RETURNS INT AS BEGIN THROW; RETURN 1; END;


In Microsoft SQL Server, the THROW statement raises an exception and transfers execution to the CATCH block of the TRY...CATCH construct. Therefore, the RETURN 1; part will never be executed.

Suppress an inspection in the editor

  1. Position the caret at the highlighted line and press Alt+Enter or click the Intention action icon.

  2. Click the arrow next to the inspection you want to suppress and select the necessary suppress action.

Last modified: 16 July 2021