issue_role.sql 379 B

12345678910111213141516171819
  1. CREATE FUNCTION `issue_role`(
  2. a_name VARCHAR(50)
  3. ) RETURNS INT(10)
  4. DETERMINISTIC
  5. READS SQL DATA
  6. SQL SECURITY INVOKER
  7. BEGIN
  8. DECLARE t_id INT(10);
  9. SELECT id
  10. INTO t_id
  11. FROM issue_roles
  12. WHERE name = a_name;
  13. IF t_id IS NULL THEN
  14. SET @error := CONCAT('Issue Role "',a_name,'" is not defined');
  15. SIGNAL SQLSTATE '45000'
  16. SET MESSAGE_TEXT = @error;
  17. END IF;
  18. return t_id;
  19. END;