mysql“不是变量或新的伪变量”消息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9751707/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 12:35:09  来源:igfitidea点击:

mysql "not a variable or NEW pseudo-variable" message

mysqlout

提问by alexei7

I'm trying to create a procedure that will enter data and then return a message in the OUT parameter, however i'm getting this message "argument 5 for routine hospital.alextest10 is not a variable or NEW pseudo-variable in BEFORE trigger"

我正在尝试创建一个过程,该过程将输入数据,然后在 OUT 参数中返回一条消息,但是我收到此消息“常规hospital.alextest10 的参数 5 不是变量或 BEFORE 触发器中的新伪变量”

i have this as my procedure:

我有这个作为我的程序:

create procedure alextest10
(IN a_patid CHAR(3), IN a_patnam VARCHAR(12), IN a_consno CHAR(3), IN a_ward CHAR(2),
OUT a_message VARCHAR(50))
BEGIN
set a_message = 'Database updated';
INSERT INTO patient (patient_id, patient_name, consultant_no, ward_no)
values (a_patid, a_patnam, a_consno, a_ward);
end!

and this as my call command:

这作为我的呼叫命令:

call alextest10 ('p99', 'Madeuppy', '999', 'w9', a_message)!

Can you help?

你能帮我吗?

Much appreciated!

非常感激!

回答by nnichols

CALL alextest10 ('p99', 'Madeuppy', '999', 'w9', @a_message);
SELECT @a_message;

回答by Peter Ershoff

You should use registerOutParameter- in your case:

您应该使用registerOutParameter- 在您的情况下:

cStmt.registerOutParameter(5, java.sql.Types.VARCHAR);

where type of cStmtis CallableStatement.

其中cStmt 的类型是CallableStatement