在mysql中存储过程 [英] store procedure in mysql
问题描述
你好朋友,
我需要您的帮助.
我知道存储过程,并且我在SQL Server中创建了sp(存储过程).但是我的问题是我想在mysql中创建sp(存储过程),所以请告诉我我必须在何处编写sp以及如何在php中调用该sp.现在我使用mysql 5.1.36和php 5.3.0.
在此先感谢
hello friend,
i want some help from your side.
i know about stored procedure and i am created sp(store procedure) in sql server. But my problem is that i want to create sp(store procedure) in mysql, so kindly inform me where i have to write the sp and how to call that sp in php. right now i use the mysql 5.1.36 and php 5.3.0.
thanks in advance
推荐答案
请看看 ^ ].您肯定会获得帮助.
Please have a look Here[^]. You will surely get some help.
您可以在几乎没有任何差异的任何sql工具中编写以下代码:
这是phpMyAdmin的示例:
You can write this code in any sql tools with little differences:
Here is the example for phpMyAdmin:
create procedure getStudentById(varId int)
begin
select * from student where student_id=varId;
end
注意:对于phpMyAdmin,不要忘记将Delimiter更改为您在sql脚本中使用的分隔符.在上述情况下,分隔符必须为
Note: for phpMyAdmin do not forget to change the Delimiter to what you have use in the sql script. In the above case, the Delimiter must be
这篇关于在mysql中存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!