Hi Arun,
It is better to redesign the code to avoid GOTO-style (
http://en.wikipedia.org/wiki/Goto), but one possible solution is to use LEAVE statement in MySQL
SQL Server code:
CREATE PROCEDURE dbo.spGetProdNum
@Id int
AS
IF @id = 0
GOTO ERR_TRAN
INSERT INTO mess_log VALUES ('Ok')
ERR_TRAN:
INSERT INTO err_log VALUES ('Error')
MySQL code:
CREATE PROCEDURE spGetProdNum(v_Id INT)
BEGIN
ERR_TRAN:
BEGIN
IF v_Id = 0 then
LEAVE ERR_TRAN;
END IF;
INSERT INTO mess_log VALUES('Ok');
END; -- the end of ERR_TRAN block
INSERT INTO err_log VALUES('Error');
END;
Of course, there are some limitations especially for nested GOTOs
--
Kind regards, Dmitry Tolpeko
SQLWays - Converts T/SQL procedures, triggers, scripts from SQL Server/Sybase to MySQL
http://www.ispirer.com