1、实例 代码如下:DELIMITER // DROP PROCEDURE IF EXISTS `test`.`p_getvalue` // CREATE DEFINER=`root`@`localhost` PROCEDURE `p_getvalue`( in id varchar(20),out s varchar(20) ) begin if (length(id)=11) then select ‘A_B_C_D’ into s; elseif(length(id)=8) then select ‘A_B_C’ into s; elseif(length(id)=5) then se