Advertisement
Guest User

Untitled

a guest
May 27th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. 1. If the primary key val exists, increment the counter column
  2. 2. Else, insert the primary key into the table
  3.  
  4. delimiter //
  5. CREATE TRIGGER volume_manager BEFORE INSERT ON individual_key_log
  6. FOR EACH ROW
  7. BEGIN
  8. IF NEW.reference_key not in (
  9. select *
  10. From individual_key_log
  11. where (NEW.reference_key = 'test')
  12. ) THEN -- MISSING THEN
  13. CALL `Insert not allowed`;
  14. END IF;
  15. END;
  16. //
  17. delimiter ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement