从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 Tool运行相同命令时,出现以下错误
> 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
答案 0 :(得分:0)
通过发出特殊命令“。”开始原始模式。然后,您可以输入任意格式的任意文本。完成后,输入仅包含“。;”的行。将输入存储到编辑缓冲区,并将其发送到数据库服务器以执行。
请参阅指南:
http://hsqldb.org/doc/2.0/util-guide/sqltool-chapt.html#sqltool_raw-sect