当前位置: 代码迷 >> 综合 >> 存储过程begin/end
  详细解决方案

存储过程begin/end

热度:12   发布时间:2024-01-17 03:11:24.0
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 |
+---------+
*/