mavenhsqldbsql-maven-plugin

sql-maven-plugin create function


I am using hsqldb and an embedded jetty instance (via) maven for testing locally. The application will use a mysql database on production. I will need to call mysql's UNHEX() for a particular query. How can I create a wrapper for hsqldb that would call it's HEXTORAW() function. I have tried the following, but sql-maven-plugin errors out.

CREATE FUNCTION "UNHEX"(t VARCHAR(100))
RETURNS VARBINARY(100)
BEGIN
RETURN HEXTORAW(t);
END;

sql-maven-plugin error:

Failed to execute goal org.codehaus.mojo:sql-maven-plugin:1.5:execute (default-cli) on project rms: Unexpected token: FUNCTION in statement [ [ERROR] CREATE FUNCTION]

How can I create the wrapper function?


Solution

  • CREATE FUNCTION is supported in HSQLDB 2.x. It should work if you use HSQLDB 2.2.8 or later.