从 Swing UI 我可以一一执行以下脚本。
ALTER CATALOG PUBLIC RENAME TO SOMENAME;
CREATE SCHEMA SOMESCHEMA;
SET DATABASE SQL SYNTAX ORA TRUE;
CREATE PROCEDURE SOMENAME.SOMESCHEMA.SP_FAILED_COUNT(IN i_ssn VARCHAR(100), IN i_page_id NUMBER(10), IN i_ip_address VARCHAR(100), IN i_session_guid VARCHAR(100), OUT o_toomanyfails VARCHAR(2000))
READS SQL DATA
BEGIN ATOMIC
SET o_toomanyfails = 'N';
END
.;
但是当我从 SQL 工具运行相同的程序时,我收到以下错误
> java -jar sqltool-2.4.1.jar --rcfile=C:\my-files\sqltool.rc web C:\my-files\hello.sql
SEVERE Rolling back SQL transaction.
Exception in thread "main" java.lang.Error: Error: could not match input
at org.hsqldb.cmdline.sqltool.SqlFileScanner.zzScanError(Unknown Source)
at org.hsqldb.cmdline.sqltool.SqlFileScanner.yylex(Unknown Source)
at org.hsqldb.cmdline.SqlFile.scanpass(Unknown Source)
at org.hsqldb.cmdline.SqlFile.execute(Unknown Source)
at org.hsqldb.cmdline.SqlTool.objectMain(Unknown Source)
at org.hsqldb.cmdline.SqlTool.main(Unknown Source)
我在堆栈溢出中发现了类似的问题。解决方案是添加 .; 在最后。但即使添加了 .; 我遇到了同样的错误。
我还加了“。” 在第一行启用原始模式。现在我得到了不同的例外
.
ALTER CATALOG PUBLIC RENAME TO SOMENAME;
CREATE SCHEMA SOMESCHEMA;
SET DATABASE SQL SYNTAX ORA TRUE;
CREATE PROCEDURE SOMENAME.SOMESCHEMA.SP_FAILED_COUNT(IN i_ssn VARCHAR(100), IN i_page_id NUMBER(10), IN i_ip_address VARCHAR(100), IN i_session_guid VARCHAR(100), OUT o_toomanyfails VARCHAR(2000))
READS SQL DATA
BEGIN ATOMIC
SET o_toomanyfails = 'N';
END
.;
例外
> java -jar sqltool-2.4.1.jar --rcfile=C:\my-files\sqltool.rc web C:\my-files\hello.sql
SEVERE SQL Error at 'C:\my-files\hello.sql' line 2:
".
ALTER CATALOG PUBLIC RENAME TO SOMENAME"
malformed numeric constant: .
org.hsqldb.cmdline.SqlTool$SqlToolException