hc学习平台

 找回密码
 立即注册
搜索
热搜: 活动 交友 javakc
 › zhangjiafu › 日志

编写带参数的存储过程,将数字0-6转换成字符串“星期日”至“星期六”

2021-01-09 18:00:31 查看(592) 回复(0)

要求;

  1. 存储过程要有输入和输出


create procedure xingqi( inout i int)

begin

declare n int;

declare result varchar(10);

set n=i;

case n

when 0 then

set result='星期日';

when 1 then

set result='星期一';

when 2 then

set result='星期二';

when 3 then

set result='星期三';

when 4 then

set result='星期四';

when 5 then

set result='星期五';

else

set result='星期六';

end case;


select n,result ;


end;

set @x=4;

call xingqi(@x);

select @x;

评论 (0 个评论)

facelist

全部作者的其他最新日志



站点统计|举报|Archiver|手机版|小黑屋|Comsenz Inc.

GMT+8, , Processed in 0.195171 second(s), 9 queries .

Powered by javakc! X1.0

© 2004-2014 javakc

f1208.com 备案号:京ICP备14030918号-1

返回顶部