I have created a trigger to Insert sum of all numbers in FinalMarks
column, each time a new Record inserted in student_marks
table.
I am getting the following error message when i am trying to insert a new record in the table.
Kindly tell me where i am making a mistake.
Thanks
Taha
-
CREATE DEFINER = `root`@`localhost` TRIGGER `insert_student` BEFORE INSERT ON `student_marks`
FOR EACH
ROW INSERT INTO student_marks( FinalMarks )
VALUES (
AssignmentMarks + QuizMarks + Hourly1 + Hourly2 + Hourly3 + ProjectMarks
)
ERROR
INSERT INTO `university`.`student_marks` (
StudentMarksId
,StudentId
,SemisterCourseId
,AssignmentMarks
,QuizMarks
,Hourly1
,Hourly2
,Hourly3
,FinalMarks
,Grades
,ProjectMarks
,GPA
) VALUES ( NULL , '1', '1', '10', '15', '20', '15', '10', '', '', '', '' )
-
#1442 - #1442 - Can't update table 'student_marks' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.