Search code examples
eclipseeclipse-pluginh2spring-boot-test

H2 JdbcSQLSyntaxErrorException: Syntax error in SQL statement - INSERT


I'm getting this error to initialize my memory database with some data because my sql script to load the data is formatted wrong to H2:

INSERT INTO cup_orchestrator.cpo_environment (`environment_id`,`environment`)
VALUES
(
   1,
   'DEV'
),

(
   2,
   'ACT'
),

(
   3,
   'PRD'
);

And H2 expected on this way:

INSERT INTO cup_orchestrator.cpo_environment (`environment_id`,`environment`) VALUES(1,'DEV'),(2,'ACT'),(3,'PRD');
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "INSERT INTO CUP_ORCHESTRATOR.CPO_ENVIRONMENT (`ENVIRONMENT_ID`,`ENVIRONMENT`)[*]"; expected "DIRECT, SORTED, DEFAULT, VALUES, SET, (, WITH, SELECT, TABLE, VALUES"; SQL statement:
INSERT INTO cup_orchestrator.cpo_environment (`environment_id`,`environment`)

Is there any plugin in Eclipse to format the sql script in the way that H2 expect? I'm using SQL Editor 1.1.0 but there is no option.


Solution

  • Changed to IntelliJ 2022.1.2 (Ultimate Edition) and solved.