CREATE PROCEDURE `spGetChapter` ( IN `P_SubjectId` INTEGER ) BEGIN DECLARE EXIT HANDLER FOR SQLEXCEPTION SELECT ? ; SELECT `Id` AS `ChapterId` , `Title` AS `ChapterName` , CODE AS `ChapterCode` FROM `tchaptermaster` WHERE ( `SubjectId` = `P_SubjectId` OR `P_SubjectId` = ? ) ; END 