DataGrip 2022.2 Help

Code Inspection: Ill-formed date/time literals

Reports errors in date and time literals. This inspection is available in MySQL, Oracle, Db2, and H2.

Example (MySQL):

SELECT TIME '10 -12:13:14' FROM dual; SELECT TIME ' 12 : 13 : 14 ' FROM dual; SELECT TIME '12 13 14' FROM dual; SELECT TIME '12-13-14' FROM dual; SELECT TIME '12.13.14' FROM dual; SELECT TIME '12:13:' FROM dual; SELECT TIME '12:13' FROM dual; SELECT TIME '12:' FROM dual;

In this example, dates ignore the MySQL standard for date and time literals. Therefore, they will be highlighted. For more information about date and time literals in MySQL, see Date and Time Literals at dev.mysql.com.

The following date and type literals are valid for MySQL.

SELECT TIME '12:13:14' FROM dual; SELECT TIME '12:13:14.555' FROM dual; SELECT TIME '12:13:14.' FROM dual; SELECT TIME '-12:13:14' FROM dual; SELECT TIME '10 12:13:14' FROM dual; SELECT TIME '-10 12:13:14' FROM dual;

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: 13 May 2022