mysql ERROR 1248: Every derived table must have its own alias
As far as I know the part:

{...}
SELECT * FROM (SELECT vBooksDetails.* FROM
{...}
);


could have caused the error - the topmost select wasn't aliased.

Please try this version of your last big insert:

INSERT INTO 
    temp_MatchList
SELECT 
    vBooksDetails.* 
FROM
(
    SELECT DISTINCT * 
    FROM 
    (
        SELECT 
            classmaster.ClassID AS ClassID,
            CDisplayName,
            subjectmaster.id,
            SubjectID, 
            subjectmaster.DispName,
            BookName 
        FROM 
            classmaster 
            JOIN subjectclasslinkage 
                ON classmaster.ClassID = subjectclasslinkage.ClassNumber
            JOIN subjectmaster 
                ON subjectclasslinkage.SubjectId = subjectmaster.id 
            LEFT JOIN 
            (
                SELECT * 
                FROM vBooksDetails 
                WHERE 
                (
                    ((p_LinkedBoard = 0 ) 
                      OR (BoardID IN (SELECT boardname FROM userboards WHERE userboards.usrid = p_UsrID ))) 
                    AND ((p_LinkedBoards = 0 ) OR (BoardID IN (SELECT BoardID FROM schoolboards ))) 
                    AND EXISTS (SELECT * FROM vBoardInfo WHERE ID = BoardID )
                    AND vBooksDetails.Status = 'A')
            ) lessonsyllabus 
            ON subjectmaster.id = lessonsyllabus.SubjectID 
               AND lessonsyllabus.ClassID = classmaster.ClassID 
    ) TAB 
    WHERE 
        TAB.BookName IS NULL 
) TAB_MISSING 
    JOIN vBooksDetails 
        ON TAB_MISSING.ClassID = vBooksDetails.ClassID 
           AND TAB_MISSING.SubjectID = vBooksDetails.SubjectID 
           AND vBooksDetails.BoardID = 3 
WHERE   
    vBooksDetails.Status = 'A' 
    AND ((p_LinkedClasses = 0 ) 
         OR ( vBooksDetails.ClassID IN (SELECT classid FROM userclasses WHERE UsrID = p_UsrID ))) 
    AND (( p_LinkedSubjects = 0 ) 
         OR (vBooksDetails.SubjectID IN (SELECT subjectid FROM usersubjects WHERE usrid = p_UsrID ))) 
-- AND ((@LinkedBoard = 0) OR (BoardID IN (SELECT boardname FROM userboards WHERE usrid=@UsrID)) )
    AND ((p_SchoolBooks = 0 ) 
         OR ( vBooksDetails.Id NOT IN ( SELECT BookID FROM SchoolBooks)));