CREATE PROCEDURE `spDeleteSubCategory` ( IN `P_SubcategoryId` INTEGER ) BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN SELECT ? ; END ; IF NOT EXISTS ( SELECT ? FROM `tSubCategoryMaster` WHERE `id` = `P_SubcategoryId` ) THEN BEGIN SELECT ? ; END ; ELSE BEGIN START TRANSACTION ; DELETE FROM `tSubCategoryMaster` WHERE `id` = `P_SubcategoryId` ; COMMIT ; SELECT ? ; END ; END IF ; END 