1、准备数据drop table if exists t1;create table t1(id int,name char(20));insert into t1 values(1,'jim');select * from t1;id name 1 jim2、创建存储过程drop procedure if exists mypro1();create procedure mypro1()returning char(20);define str1 char(20...
显示全部
1、准备数据
drop table if exists t1;
create table t1(id int,name char(20));
insert into t1 values(1,'jim');
select * from t1;
id name
1 jim
2、创建存储过程
drop procedure if exists mypro1();
create procedure mypro1()
returning char(20);
define str1 char(20);
select name into str1 from t1;
return str1;
end procedure;
execute procedure mypro1();
执行结果:
jim
3、问题
请问存储过程中select语句中的name,能否通过参数传递进去,也就是使用表的列名做为存储过程的参数传递到存储过程中。
划重点:不是简单的给存储过程传递参数,而是传递的参数是表的列名
收起