DELIMITER //
CREATE PROCEDURE pCase2()
BEGIN
DECLARE vNum CHAR(20);
SET vNum = 80;
CASE
WHEN vNum IS NULL THEN SELECT ‘没有分
数’;
WHEN vNum>90 THEN SELECT ‘成绩优异’;
WHEN vNum<90 AND vNum>=60 THEN SELECT
‘成绩良’;
ELSE SELECT ‘没有及格’;
END CASE;
END;//
DELIMITER ;
DELIMITER //
CREATE PROCEDURE pCase()
BEGIN
DECLARE job CHAR(50);
SET job =’a’;
CASE job
WHEN ‘a’ THEN SELECT ‘工作是经理
‘;
WHEN ‘b’ THEN SELECT ‘工作是财务
‘;
WHEN ‘c’ THEN SELECT ‘工作是人事
‘;
WHEN ‘d’ THEN SELECT ‘工作是行政
‘;
ELSE SELECT ‘是其它工作’;
END CASE;
END;//
DELIMITER ;
原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/244910.html