Re: Trigger question..please help.
Date: Fri, 27 Mar 2009 12:53:06 -0700 (PDT)
On Mar 27, 4:27 pm, Shakespeare <what..._at_xs4all.nl> wrote:
> I don't think you need a procedure for this. You don't need to query the
> emp table. Just do the bookkeeping in the trigger:
> If an employee is inserted, add 1 to total employees, and add the salary
> to the total;
> If an employee is deleted, substract the salary and substract 1 from total;
> if an employee gets updated, substract the old salary and add the new
> Of course, this will fail when the table is truncated.....
Yes I can do that but the dept_stat1 table also has an attribute dname (department name) and that must be updated too. Also, the total_employees and total_salary is for a particular department. How would the trigger know which department has been updated. Received on Fri Mar 27 2009 - 14:53:06 CDT