I am stuck at somewhere and I need some help from you.
I have two databases i.e., test_db1
and test_db2
and have users
Check out the syntax for DECLARE HANDLER
http://dev.mysql.com/doc/refman/5.1/en/declare-handler.html
Also, if you're trying to debug a SP, this might be helpful for you:
http://www.bluegecko.net/mysql/debugging-stored-procedures/
Upon trigger you can use something like below :
CREATE TRIGGER `my_table_AINS` AFTER INSERT ON `my_table` FOR EACH ROW
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION
RESIGNAL;
DECLARE EXIT HANDLER FOR SQLWARNING
RESIGNAL;
DECLARE EXIT HANDLER FOR NOT FOUND
RESIGNAL;
-- Do the work of the trigger.
END
Hope this may help you.