I have a very simple HSQLDB CREATE PROCEDURE statement:
CREATE PROCEDURE test_procedure()
CONTAINS SQL
BEGIN
DECLARE test_variable INTEGER;
SET test_variable = 0;
END
When I try to execute this SQL using SQLTool, it fails with a "Unterminated input" error. The command I am using is:
java -jar -cp $HSQLDB_HOME/lib/sqltool.jar:$HSQLDB_HOME/lib/hsqldb.jar $HSQLDB_HOME/lib/sqltool.jar db script.sql
The exact error I get is:
SEVERE Error at 'script.sql' line 7:
"? CREATE PROCEDURE test_procedure()
CONTAINS SQL
BEGIN ATOMIC
DECLARE test_variable INTEGER;
SET test_variable = 0;
END"
Unterminated input: "CREATE PROCEDURE test_procedure()
CONTAINS SQL
BEGIN ATOMIC
DECLARE test_variable INTEGER;
SET test_variable = 0;
END"
org.hsqldb.cmdline.SqlTool$SqlToolException
So far I have figured out this much:
- If I run this SQL using one of the GUI tools provided by HSQLDB (like DatabaseManagerSwing), it works fine.
- I can execute other SQL statements using the exact same command (selects, inserts, deletes, etc.), but not CREATE PROCEDURE
- My script.sql file contains only 6 lines, but the error mentions line 7, which makes no sense to me
- Adding a semicolon at the end of the SQL in the file makes no difference
- I have tried this both on Windows and on Linux with the exact same results
- I have tried to pass the file to SQL Tool through stdin and by using inline SQL with the exact same results
- I have tried changing the stored procedure body to something else, but it did not make a difference
I am out of ideas at this point. Has anyone encountered this error? Is there something that can be done about it?