# Mysql cancel insert record


```
BEGIN
	  declare pCountAppPoint int default 0; 

-- 	Check update app point for upload avatar
	if NEW.point_type=4 then
			SET pCountAppPoint= (select count(member_id) from h247app_points where point_type=4 and source_id=NEW.source_id and member_id=NEW.member_id);
			if pCountAppPoint >0 then
					SIGNAL SQLSTATE '45000';
			end if;
			
	-- 	Check update app point for upload avatar		
	elseif  NEW.point_type=5 then
		SET pCountAppPoint= (select count(member_id) from h247app_points where point_type=5 and source_id=NEW.source_id and member_id=NEW.member_id);
			if pCountAppPoint >0 then
					SIGNAL SQLSTATE '45000';
			end if;
	end if;
	
END
``` 

