Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Using the Avg() function
I understand how to use the Avg() function but how would I go about using it
in a trigger so that when a column is updated it calculates the average of
that column but only for the records with the same primary key ans the
record being updated. This is what I have for a trigger so far:
CREATE OR REPLACE TRIGGER Score
BEFORE INSERT on Phase2_5Ans
FOR EACH ROW
DECLARE
Temp varchar2(30);
BEGIN
Select Avg(Score) from Phase2_5Ans where ??? into temp from dual; :New.TotalScore := Temp;
Can anyone help me?? I know there is a simple solution to my problem I just don't know how to pass a variable to the where clause.
Thanks again,
Jeff
Received on Thu Sep 06 2001 - 12:26:25 CDT
![]() |
![]() |