首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

存储过程,变量处理方式,自定义显示列解决方案

2012-06-13 
存储过程,变量处理方式,自定义显示列tableid name number1 fdfdfd 32232 dfdfdf 4566存过程如下:create pr

存储过程,变量处理方式,自定义显示列
table
id name number
1 fdfdfd 3223
2 dfdfdf 4566
存过程如下:
create procedure Ptest(in id int)
begin
select * from table where id=id;
end;//
call Ptest('1')//
将得到
第一行。
问题是:
我要实理,只定义,输出name,或number只要一列,如何实现呢?就是,我让他
类似这样一个函数
function(id,lie){
select lie from table where id = id
}

因此我的过程这样写,但不写变量如何处理
create procedure Ptest(in id int,in lie varchar(20))
begin
select lie from table where id=id;
end;//
call Ptest('1')//
输出的结果不对。应该怎么写啊???

[解决办法]
如果你是在命令行下输入的,只有先DROP,再建立
如果你用图形化管理工具,可以直接修改

热点排行