Re: Trigger question..please help.

From: pereges <>
Date: Fri, 27 Mar 2009 12:53:06 -0700 (PDT)
Message-ID: <>

On Mar 27, 4:27 pm, Shakespeare <> 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
> salary.
> 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

Original text of this message