Posted By

ktrout on 01/03/16


Tagged

mysql error procedure exception throw


Versions (?)

mysql procedure throw_error


 / Published in: SQL
 

procedure to throw application defined error

  1. DROP procedure IF EXISTS throw_error;
  2. delimiter $$
  3. CREATE PROCEDURE throw_error (errno BIGINT UNSIGNED, message VARCHAR(256))
  4. BEGIN
  5. SIGNAL SQLSTATE 'ERROR'
  6. SET
  7. MESSAGE_TEXT = message,
  8. MYSQL_ERRNO = errno;
  9. END $$
  10. delimiter ;

Report this snippet  

You need to login to post a comment.