在 DbVisualizer 中创建 HSQLDB 过程
Creating HSQLDB Procedure in DbVisualizer
我正在尝试通过 DbVisualizer 客户端创建以下简单的 HSQLDB
过程。
DROP PROCEDURE IF EXISTS my_procedure;
CREATE PROCEDURE my_procedure(OUT my_output INTEGER, IN my_input INTEGER)
MODIFIES SQL DATA -- NO SQL
BEGIN ATOMIC
SET my_output = my_input;
END
错误信息:
[CREATE - 0 rows, 0.001 secs] [Code: -5590, SQL State: 42590] unexpected end of statement: required: ; : line: 3
[END - 0 rows, 0.000 secs] [Code: -5581, SQL State: 42581] unexpected token: END
... 2 statement(s) executed, 0 rows affected, exec/fetch time: 0.001/0.000 sec [0 successful, 2 errors]
看起来 there is a problem 的解释是 ;
,但我在 HSQLDB
中找不到任何等同于 MySQl
delimiter
的东西。
如何解决这个问题?
在 DbVisualizer 中,我可以使用 DbVisualizer 特定的分隔符。
@delimiter ++;
DROP PROCEDURE IF EXISTS my_procedure;
CREATE PROCEDURE my_procedure(OUT my_output INTEGER, IN my_input INTEGER)
MODIFIES SQL DATA -- NO SQL
BEGIN ATOMIC
SET my_output = my_input;
END
;
++
@delimiter ;++
Using the @delimiter command
With the @delimiter command you can temporarily change the statement
delimiter DbVisualizer uses to separate the statements and send them
one by one to the database. Use it before the complex statement, and
after the statement if the script contains additional statements.
Here's an example:
@delimiter ++;
CREATE OR REPLACE FUNCTION HELLO (p1 IN VARCHAR2) RETURN VARCHAR2
AS
BEGIN
RETURN 'Hello ' || p1;
END;
++
@delimiter ;++
@call ${returnValue||(null)||String||noshow dir=out}$ = HELLO('World');
@echo returnValue = ${returnValue}$;
The first @delimiter command sets the delimiter to ++ so that the
default ; delimiter can be used within the function body in the CREATE
statement. The ++ delimiter is then used to end the CREATE statement,
and another @delimiter command sets the delimiter back to ; for the
remaining commands in the script.
我正在尝试通过 DbVisualizer 客户端创建以下简单的 HSQLDB
过程。
DROP PROCEDURE IF EXISTS my_procedure;
CREATE PROCEDURE my_procedure(OUT my_output INTEGER, IN my_input INTEGER)
MODIFIES SQL DATA -- NO SQL
BEGIN ATOMIC
SET my_output = my_input;
END
错误信息:
[CREATE - 0 rows, 0.001 secs] [Code: -5590, SQL State: 42590] unexpected end of statement: required: ; : line: 3
[END - 0 rows, 0.000 secs] [Code: -5581, SQL State: 42581] unexpected token: END
... 2 statement(s) executed, 0 rows affected, exec/fetch time: 0.001/0.000 sec [0 successful, 2 errors]
看起来 there is a problem 的解释是 ;
,但我在 HSQLDB
中找不到任何等同于 MySQl
delimiter
的东西。
如何解决这个问题?
在 DbVisualizer 中,我可以使用 DbVisualizer 特定的分隔符。
@delimiter ++;
DROP PROCEDURE IF EXISTS my_procedure;
CREATE PROCEDURE my_procedure(OUT my_output INTEGER, IN my_input INTEGER)
MODIFIES SQL DATA -- NO SQL
BEGIN ATOMIC
SET my_output = my_input;
END
;
++
@delimiter ;++
Using the @delimiter command
With the @delimiter command you can temporarily change the statement delimiter DbVisualizer uses to separate the statements and send them one by one to the database. Use it before the complex statement, and after the statement if the script contains additional statements. Here's an example:
@delimiter ++; CREATE OR REPLACE FUNCTION HELLO (p1 IN VARCHAR2) RETURN VARCHAR2 AS BEGIN RETURN 'Hello ' || p1; END; ++ @delimiter ;++ @call ${returnValue||(null)||String||noshow dir=out}$ = HELLO('World'); @echo returnValue = ${returnValue}$;
The first @delimiter command sets the delimiter to ++ so that the default ; delimiter can be used within the function body in the CREATE statement. The ++ delimiter is then used to end the CREATE statement, and another @delimiter command sets the delimiter back to ; for the remaining commands in the script.