mysql存储过程

DELIMITER $$

DROP PROCEDURE IF EXISTS `lekan`.`QueryUserExtend` $$
CREATE DEFINER=`root`@`%` PROCEDURE `QueryUserExtend`(in p_userId  bigint,
out p_ticketNum int  ,out p_mood varchar(500) ,out p_avatarNum int,out p_theaterNum int,out p_collectNum int,out p_friendNum int,out p_badgeNum int,out p_userScoreNum int,out p_userCommentNum int,out p_userWatchNum int)
begin
select ticketNum,mood into p_ticketNum,p_mood  from user_extend where userId=p_userId;
select count(tranId)  into p_avatarNum from user_transformers where userId=p_userId and tranType=2;
select count(tranId)  into p_theaterNum from user_transformers where userId=p_userId and tranType=1;
select count(id) into  p_collectNum from user_collected_video where userId=p_userId;
select count(id) into p_friendNum from user_friend f,user u where f.userId=p_userId and f.friendId=u.userId;
select count(id) into p_badgeNum from user_badge where userId=p_userId;
select count(distinct(videoId)) into p_userScoreNum from user_video_score where userId=p_userId;
select count(vc.commentId) into p_userCommentNum from video v join video_comment vc where  vc.videoId=v.videoId and vc.parentId=0 and vc.userId =p_userId;
select count(videoId) into p_userWatchNum  from user_watched_video where  userId = p_userId;
end $$

DELIMITER ;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值