mysql存储过程问题请教

[复制链接]
查看11 | 回复1 | 2011-1-24 17:26:10 | 显示全部楼层 |阅读模式
问题又来了:类似
declare iLast_rep_sync_id int;
......
select eid into iLast_rep_sync_id from rep_de_proc_log where tbl='rep_shadow_rs';
这个例子中可以将select到得eid值存到iLast_rep_sync_id中。
现在我要执行的一个SELECT查询,本是得到多条记录一个结果集,我附加用了limit 1,只取第一条:
declare par_user_idint;
......
SELECT proxy_price ,bidding_paddle ,user_id into par_user_id
from ecs_bidder
where is_proxy = 1 and goods_id = p_goods_id (传进来的参数)
ORDER BY proxy_price desc limit 1;
虽然查询只会得到一条记录,但是无法这样将字段user_id
into到par_user_id 变量中。原因我想是查询出来本来是2条记录,对应会有2个值,而par_user_id 只有一个。
我在接下来中需要用到user_id 查询出来的值,请教各位如何解决?

回复

使用道具 举报

千问 | 2011-1-24 17:26:10 | 显示全部楼层
SELECT proxy_price ,bidding_paddle ,user_id into par_user_id from ecs_bidder where is_proxy = 1 and goods_id = p_goods_id (传进来的参数)ORDER BY proxy_price desc limit 1;你这条语句对吗?运行不报错?查询出三个变量的值只into给一个变量?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行