Inspectopedia 2024.3 Help

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;

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

SqlDateTime
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | SQL

Last modified: 03 December 2024