MySQL Forums
Forum List  »  Triggers

Re: Trigger to update a value
Posted by: Peter Brawley
Date: March 19, 2018 11:27AM

Your TotalLineValue column is calculated from the values of other `material columns, so it should be either calculated when needed by queries, or made a derived column in the table, or made a column in a view based on the `material` table.

Your Trigger can just as easily say ...

... select sum(quantity*unit_price) from material ...

And btw Hungarian name notation (camel case, medial capitals) does improve readability but can wreak havoc when the db moves to a case-sensitive environment like Linux, best avoided.

Options: ReplyQuote


Subject
Views
Written By
Posted
1403
March 19, 2018 06:55AM
610
March 19, 2018 11:10AM
Re: Trigger to update a value
805
March 19, 2018 11:27AM
593
March 22, 2018 10:31AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.