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 ;
时间: 2024-11-07 19:51:33