gpt4 book ai didi

mysql - 在 DbVisualizer 中创建 HSQLDB 过程

转载 作者:行者123 更新时间:2023-11-29 07:38:04 25 4
gpt4 key购买 nike

我正在尝试通过 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 ;++

来自Dbvisualizer documentation :

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.

关于mysql - 在 DbVisualizer 中创建 HSQLDB 过程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47819963/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com