[英]how to create stored procedure in mysql for java?
这是我的代码:
DELIMITER $$
begin
declare var a int;
set a="select biology from app.students where studname="ganesh";
select concat('the student name is' a);
end$$
我想在mysql中为Java创建storeprodure。 在上面的代码中,我在开始后给出了任何显示错误的信息。 我的存储过程不好。
试试这个,你在"ganesh"
和concat函数中都出错了,
丢失了
DELIMITER $$
begin
declare var a int;
set a="select biology from app.students where studname='ganesh'";
select concat('the student name is', a);
end$$
只需像通常一样在MySql工作台中创建存储过程即可。 从Java或其他任何地方调用它都没关系。 您的存储过程看起来很凌乱,但意义不大,因此我认为您需要进行处理!
尝试仅使用查询分析器,而不首先在存储过程中构建查询。
编写该语句后,将其嵌入到存储过程中,然后检查您仍然可以调用它,并且该语句可以在查询分析器中运行。
写入存储过程后,您就可以使用PreparedStatement对其进行调用,就像对其他任何SQL语句一样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.