首页 > 代码库 > mysql,用存储过程插入中文导致乱码问题解决办法

mysql,用存储过程插入中文导致乱码问题解决办法

DELIMITER $$

USE `u2_test10`$$

DROP PROCEDURE IF EXISTS `Pro_apply`$$

CREATE DEFINER=`root`@`%` PROCEDURE `Pro_apply`(IN aid INT,IN uid INT,IN reas CHAR(50) CHARACTER SET utf8)//char(50) 这只urf-8
BEGIN
DECLARE score INT;
SELECT COUNT(*) INTO score FROM app_apply WHERE appId= aid AND applyUserId=uid;
IF score = 0 THEN
INSERT INTO app_apply (appId,reason,applyUserId,applyTime,`status`) VALUE(aid,reas,uid,NOW(),0);
ELSE
UPDATE app_apply SET reason=reas , STATUS=0 WHERE appId=aid AND applyUserId=uid ;
END IF;
END$$

DELIMITER ;

mysql,用存储过程插入中文导致乱码问题解决办法