CREATE PROCEDURE `spDeleteBatch` ( IN `P_BatchId` INTEGER ) BEGIN START TRANSACTION ; DELETE FROM `tchatgroupmaster` WHERE `BatchId` = `P_BatchId` ; DELETE FROM `tetest` WHERE `BatchId` = `P_BatchId` ; DELETE FROM `tfeesetup` WHERE `BatchId` = `P_BatchId` ; DELETE FROM `thomework` WHERE `BatchId` = `P_BatchId` ; DELETE FROM `tnoticeboard` WHERE `BatchId` = `P_BatchId` ; DELETE FROM `tonlinelecture` WHERE `BatchId` = `P_BatchId` ; DELETE FROM `tonlinelecturemeetingaccount` WHERE `BatchId` = `P_BatchId` ; DELETE FROM `tonlinelecturemeetingsettings` WHERE `BatchId` = `P_BatchId` ; DELETE FROM `tteachercontentassign` WHERE `BatchId` = `P_BatchId` ; DELETE FROM `ttimetable` WHERE `BatchId` = `P_BatchId` ; UPDATE `tnotification` SET `BatchId` = REPLACE ( REPLACE ( REPLACE ( `BatchId` , `CONCAT` ( `P_BatchId` , ? ) , ? ) , `CONCAT` ( ? , `P_BatchId` ) , ? ) , `P_BatchId` , ? ) WHERE `FIND_IN_SET` ( `P_BatchId` , `BatchId` ) ; DELETE FROM `tassignbatch` WHERE `BatchId` = `P_BatchId` ; DELETE FROM `tnotification` WHERE `BatchId` = ? ; DELETE FROM `tbatch` WHERE `Id` = `P_BatchId` ; COMMIT ; SELECT ? ; END 