mysql如何创建存储过程?

我的版本是5.1.11
create procedure test.insert_message(in p_id int(11),in p_title varchar(20),in p_content text)
begin
insert into message values(p_id,p_title,p_content);
end
为什么这段代码没用呢
还有就是如果有这么一个存储器
create procedure test.insert_message(in p_id int(11),out p_value varchar(20))
begin
select title from message into p_value;
end
如何得到输出值呢?
回答得好一定加分

1 用mysql客户端登入
2 选择数据库
  mysql>use test
3 查询当前数据库有哪些存储过程
  mysql>show procedure status where Db='test'
4 创建一个简单的存储过程
  mysql>create procedure hi() select 'hello';
5 存储过程创建完毕,看怎么调用它
  mysql>call hi();
显示结果 mysql> call hi();
  +-------+
  | hello |
  +-------+
  | hello |
  +-------+
  1 row in set (0.00 sec) Query OK, 0 rows affected (0.01 sec)
6 一个简单的储存过程就成功了
温馨提示:答案为网友推荐,仅供参考
第1个回答  2021-04-01

MySQL教程4 MySQL8运算符、函数、存储过程及新增数据类型 17.之创建带有IN和OUT参数的存储过程 学习猿地

第2个回答  2011-06-09
囧~ 有select 就能输出啊...~
你存储过程没什么问题啊....
程序读取有问题吧....~
相似回答