Bobby Burke Bobby Burke 3 1 1 silver badge 2 2 bronze badges. Add a comment. Active Oldest Votes. Improve this answer. Albert Godfrind Albert Godfrind 1, 4 4 silver badges 7 7 bronze badges. My insert statement was just inserting NULL for all columns to test if the trigger would fire. So when you set them both to NULL, the database will check if those values exist in the tables your foreign key references The very reason for having foreign keys is to make sure your data is consistent - i.
That actually prevents you from inserting NULLs in either of the columns. Why is that? Thanks Sanjeeva. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Finally, specify the trigger body which contains one or more SQL statements that execute when the trigger is invoked. First, create a new table called WorkCenters :. Second, create another table called WorkCenterStats that stores the summary of the capacity of the work centers:.
The following trigger updates the total capacity in the WorkCenterStats table before a new work center is inserted into the WorkCenter table:. When do you get error? After you write the trigger or when you update the table and trigger gets executed? Thanks for the quick response, i really appreciate it. I am using phpMyAdmin 4.
It ignores the trigger when is OLD. Add a comment. Active Oldest Votes. KielSoft KielSoft 3 3 silver badges 9 9 bronze badges. The problem now is that the Insert does not work if the condition is met. Help pls. Did you set the delimeter back to; with delimiter ; command? What is your error now?
Are you sure that your NEW. Show 3 more comments.
0コメント