renanleandrof
renanleandrof

Reputation: 7017

Create view on h2 database

I'm trying to create a view on H2SQL, but i cannot find the correct syntax.

I'm using:

CREATE VIEW dbo.Log
AS
SELECT * FROM dbo.MyTable

And i receive the error:

Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "CREATE VIEW DBO.LOG "; expected "COMMENT, (, AS"; 

What is the right syntax?

Upvotes: 5

Views: 18421

Answers (1)

renanleandrof
renanleandrof

Reputation: 7017

It's a bug on this version of h2 (1.4.182).

When running a CREATE VIEW from a RUNSCRIPT command, it doesn't handle well the line-breaks (\n) on the file. I resolved adding a comment (--) before each line break.

Upvotes: 10

Related Questions