Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. If the primary key val exists, increment the counter column
- 2. Else, insert the primary key into the table
- delimiter //
- CREATE TRIGGER volume_manager BEFORE INSERT ON individual_key_log
- FOR EACH ROW
- BEGIN
- IF NEW.reference_key not in (
- select *
- From individual_key_log
- where (NEW.reference_key = 'test')
- ) THEN -- MISSING THEN
- CALL `Insert not allowed`;
- END IF;
- END;
- //
- delimiter ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement