BEGIN
declare pCountAppPoint int default 0;
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;
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