CREATE PROCEDURE `spCreateNotification` ( IN `P_TeacherId` INTEGER , IN `P_BatchId` VARCHARACTER (?) , IN `P_Title` VARCHARACTER (?) , IN `P_NotificationText` VARCHARACTER (?) , IN `P_NotificationDate` DATETIME ) BEGIN DECLARE `P_NotificationId` INTEGER DEFAULT ? ; START TRANSACTION ; INSERT INTO `tnotification` ( `TeacherId` , `BatchId` , `Title` , `NotificationText` , `NotificationDate` , `CreatedDateTime` , `UpdatedDateTime` ) VALUES ( `P_TeacherId` , `P_BatchId` , `P_Title` , `P_NotificationText` , `P_NotificationDate` , NOW ( ) , NOW ( ) ) ; SET `P_NotificationId` = `LAST_INSERT_ID` ( ) ; SELECT `P_NotificationId` ; COMMIT ; END 