Mysql 函数创建
DELIMITER $$
DROP FUNCTION IF EXISTS `shouy`.`Sel_FUNC_GOODS_type` $$
CREATE FUNCTION `shouy`.`Sel_FUNC_GOODS_type` (TypeID int)
RETURNS VARCHAR(100)
begin
DECLARE NAYIBU_FIR VARCHAR(100) DEFAULT ''; /*局部变量*/
select (T1.CATE_NAME) into NAYIBU_FIR from shouy.pos_category T1 INNER JOIN pos_category T2
ON T1.ID=T2.CATE_PID where T1.ID=TypeID limit 1;
return NAYIBU_FIR;
end $$
DELIMITER ;
select Sel_FUNC_GOODS_type(1)