Skip to main content

Command Palette

Search for a command to run...

Mysql cancel insert record

Published
1 min readView as Markdown
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

More from this blog

Khang Nguyen

119 posts