Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> triger begginer
Hi
Well I'm trying to make simple trigger, when updating
tableA.qty I just want to calculate with record from tableB.price and record
from tableA.qty and write result in tableA.amount.
PROMPT Creating Trigger 'IZRACUN_IZPLACILA'
CREATE OR REPLACE TRIGGER Calculate_amount
AFTER UPDATE OF QTY
ON TABLE_A
FOR EACH ROW
WHEN (NOT(new.QTY = old.QTY)
DECLARE
pPRICE NUMBER;
--this I think it works - just getting value from
--TABLE_B.price
SELECT price INTO pPRICE
FROM TABLE_B, TABLE_C
WHERE TABLE_C.idC = :old.C_id
AND TABLE_C.B_id=TABLE_B.idB;
END IF; -- updating
END;
Thx a lot
RK
Received on Tue Apr 06 2004 - 14:44:31 CDT