drop table if exists t;
create table t (s1 int);
insert into t values (5);
select * from t;
-- --------------------------------------------------
drop procedure if exists p7;
delimiter //
create procedure p7()
begin
set @a = 6;
set @b = 5; -- 定义两个客户端变量
insert into t values (@a);
select s1 * @a from t where s1 >= @b;
end; //
delimiter ;
call p7();
/*
+---------+
| s1 * @a |
+---------+
| 30 |
| 36 |
+---------+
*/存储过程begin/end
最新推荐文章于 2024-10-05 22:47:23 发布
本文提供了一个简单的SQL操作流程示例,包括创建表、插入数据、调用存储过程等步骤,并展示了如何通过存储过程使用客户端变量进行数据处理。
1601

被折叠的 条评论
为什么被折叠?



