mysql 函数 存储过程 互调用

getrand()

BEGIN
RETURN (SELECT (FLOOR(RAND()*64)) from cs_admin);
END

函数 返回随机数

 

 

 

getinfoimg()

BEGIN
set @y=getrand();
SELECT info_imgpath_icon from cs_temp where info_id=@y into @x;

RETURN (@x);
END

函数 返回cs_temp  中 info_imgpath字段的getrand()随机数的图片地址

 

 

 

BEGIN
set @y=getrand();
SELECT info_imgpath_icon from cs_info where info_id=@y into @x;
select @x;


END

存储过程 img

posted on 2018-06-11 20:57  hackermi  阅读(593)  评论(1编辑  收藏  举报

导航