日期:2014-05-16 浏览次数:20744 次
CREATE PROCEDURE `Up_MyConcern_Ins`( IN Id_Int , IN StarConcern_VarC varchar(800), IN TI_Id_Int, IN ChannelNo_Int, IN UserName_VarC varchar(800) , OUT ReturnValues_Int INT ) PROC: BEGIN DECLARE IsExists_Int INT; DECLARE Id_Int INT; DECLARE EXIT HANDLER FOR SQLSTATE'23000' BEGIN SET ReturnValues_Int = 1; ROLLBACK; END; SET AUTOCOMMIT = 0; START TRANSACTION; SET ReturnValues_Int = 0; SELECT COUNT(1) INTO IsExists_Int FROM MyConcern WHERE MC_StarConCern_VarC = StarConCern_VarC; IF IsExists_Int = 0 THEN SET ReturnValues_Int = 2; ROLLBACK; LEAVE PROC; END IF; INSERT INTO MyConcern(MC_Id_Int,MC_TI_Id_Int,MC_ChannelNo,MC_UserId_Int,MC_UserName_VarC,MC_StarConcern_VarC) VALUES(Id_Int,FN_Id_Int,ChannelNo_Int,UserId_Int,UserName_VarC,StarConcern_VarC);