Search code examples
databaseh2in-memory-database

H2 DB: is "CROSS" a special keyword used from H2 to avoid to use in a create table statement?


I am trying to create a simple table with several columns. As soon as I try to add the column "CROSS" I get the following exception:

Create table TABLE_TEST ( CROSS VARCHAR2(6) , COLUMN_1 TIMESTAMP(6) , COLUMN_2 TIMESTAMP(6) , COLUMN_3 NUMBER(17,3) , COLUMN_4 VARCHAR2(1) ) [42001-194] 42001/42001 (Help) org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "CREATE TABLE TABLE_TEST ( CROSS[*] VARCHAR2(6) , COLUMN_1 TIMESTAMP(6) , COLUMN_2 TIMESTAMP(6) , COLUMN_3 NUMBER(17,3) , COLUMN_4 VARCHAR2(1) ) "; expected "identifier"; SQL statement: Create table TABLE_TEST ( CROSS VARCHAR2(6) , COLUMN_1 TIMESTAMP(6) , COLUMN_2 TIMESTAMP(6) , COLUMN_3 NUMBER(17,3) , COLUMN_4 VARCHAR2(1) ) [42001-194] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.getSyntaxError(DbException.java:205) at org.h2.command.Parser.readColumnIdentifier(Parser.java:3231) at org.h2.command.Parser.parseCreateTable(Parser.java:6052) at org.h2.command.Parser.parseCreate(Parser.java:4302) at org.h2.command.Parser.parsePrepared(Parser.java:364) at org.h2.command.Parser.parse(Parser.java:319) at org.h2.command.Parser.parse(Parser.java:291) at org.h2.command.Parser.prepareCommand(Parser.java:256) at org.h2.engine.Session.prepareLocal(Session.java:564) at org.h2.engine.Session.prepareCommand(Session.java:505) at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1204) at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:170) at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:158) at org.h2.server.web.WebApp.getResult(WebApp.java:1380) at org.h2.server.web.WebApp.query(WebApp.java:1053) at org.h2.server.web.WebApp$1.next(WebApp.java:1015) at org.h2.server.web.WebApp$1.next(WebApp.java:1002) at org.h2.server.web.WebThread.process(WebThread.java:164) at org.h2.server.web.WebThread.run(WebThread.java:89) at java.lang.Thread.run(Thread.java:745)

Any Idea?


Solution

  • Yes, "CROSS" is a H2 Keywords / Reserved Words