Stored Procedure error code
Hello All,
I'm writing many stored procedure in MySQL like one for insert transaction as shown below:-
drop procedure if exists ` sp_InsertQuery `;
DELIMITER $$;
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_InsertQuery`(IN p_col1 VARCHAR(700),
IN p_col2 VARCHAR(700),IN p_col3 TIMESTAMP, OUT result INT)
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION Set result = 0;
Begin
Insert INTO <table_name> (col1,col2,col3)
Values(p_col1,p_col2,p_col3);
End;
Set result = 1;
END$$
DELIMITER ;$$
Although the stored procedure is working fine, but now I’m having a different requirement. Instead of handling exceptions using EXIT HANDLER and returning "result = 0", i need to return the error code from stored procedure in "result" variable.
I need to perform the same requirement for other stored procedure performing "select", "delete" and "update" transaction in database.
Please suggest for how to achieve this requirement?
Thanks in advance.
Subject
Views
Written By
Posted
Stored Procedure error code
3338
February 17, 2014 09:38AM
1118
February 27, 2014 08:45PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.