CREATE PROCEDURE `spCopyTest` ( IN `P_TestId` INTEGER , IN `P_BatcaXml` LONGTEXT ) BEGIN DECLARE `Count` INTEGER DEFAULT ? ; DECLARE `i` INTEGER DEFAULT ? ; DECLARE `P_Id` INTEGER DEFAULT ? ; DECLARE `P_ParaId` INTEGER DEFAULT ? ; DROP TEMPORARY TABLE IF EXISTS `T_Result` ; CREATE TEMPORARY TABLE `T_Result` ( `BatchId` INTEGER , `OldQuestionPath` LONGTEXT , `OldOptionPath` LONGTEXT , `NewQuestionId` INTEGER , `NewOptionId` INTEGER ) ; SET `Count` = `ExtractValue` ( `P_BatcaXml` , ? ) ; WHILE `i` <= `Count` DO DROP TEMPORARY TABLE IF EXISTS `TEMPtparaquestionsIds` ; DROP TEMPORARY TABLE IF EXISTS `TEMPtetestquestionsIds` ; INSERT INTO `vida_lms` . `tetest` ( `MainTestTypeId` , `SubTestTypeId` , `CorrectAnswerMarks` , `PenaltyMarks` , `BatchId` , `Topic` , `Description` , `Duration` , `StartDate` , `StartTime` , `ExpiryDate` , `ExpiryTime` , `Maxmarks` , `IsSubmitted` , `SubCategoryId` , `CreatedUserId` , `CreatedDateTime` ) SELECT `MainTestTypeId` , `SubTestTypeId` , `CorrectAnswerMarks` , `PenaltyMarks` , `ExtractValue` ( `P_BatcaXml` , `CONCAT` ( ? , `i` , ? ) ) , `Topic` , `Description` , `Duration` , `StartDate` , `StartTime` , `ExpiryDate` , `ExpiryTime` , `Maxmarks` , 