织梦CMS - 轻松建站从此开始!

欧博ABG官网-欧博官方网址-会员登入

Creating a procedure in mySql with parameters

时间:2025-07-22 10:31来源: 作者:admin 点击: 0 次
Its very easy to create procedure in Mysql. Here, in my example I am going to create a procedure which is responsible to fetch all data from student t

Its very easy to create procedure in Mysql. Here, in my example I am going to create a procedure which is responsible to fetch all data from student table according to supplied name.

DELIMITER // CREATE PROCEDURE getStudentInfo(IN s_name VARCHAR(64)) BEGIN SELECT * FROM student_database.student s where s.sname = s_name; END// DELIMITER;

In the above example ,database and table names are student_database and student respectively. Note: Instead of s_name, you can also pass @s_name as global variable.

How to call procedure? Well! its very easy, simply you can call procedure by hitting this command

$mysql> CAll getStudentInfo('pass_required_name');

enter image description here

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2025-07-22 18:07 最后登录:2025-07-22 18:07
栏目列表
推荐内容