AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Cara membuat trigger insert4/3/2023 NEW.amount which means “ the value of the amount column to be inserted into the new row.” In the example, the trigger body is a simple SET that accumulates into a user variable the values inserted into the amount column. You can also create triggers for DELETE and UPDATE operations.įOR EACH ROW defines the trigger body that is, the statement to execute each time the trigger activates, which occurs once for each row affected by the triggering event. INSERT operations cause trigger activation. The keyword INSERT indicates the trigger event that is, the type of operation that activates the trigger. The other permitted keyword here is AFTER. In this case, the trigger activates before each row inserted into the table. The keyword BEFORE indicates the trigger action time. It also includesĬlauses that specify the trigger action time, the triggering event, and what to do when the trigger activates: The CREATE TRIGGER statement creates a trigger named ins_sum that is associated with the account table. Mysql> CREATE TRIGGER ins_sum BEFORE INSERT ON account mysql> CREATE TABLE account (acct_num INT, amount DECIMAL(10,2)) The trigger acts as an accumulator, summing the values inserted into one of the columns of the table. Here is a simple example that associates a trigger with a table, to activate for Section 13.1.22, “CREATE TRIGGER Statement”, and Section 13.1.34, “DROP TRIGGER Statement”. To create a trigger or drop a trigger, use the CREATE TRIGGER or DROP TRIGGER statement, described in Apa peristiwa yang menyebabkan trigger dilakukan?.
0 Comments
Read More
Leave a Reply. |