I want to create an update trigger for a table called payment that will update the cost column with the difference between get_out
and get_in
multiplied price value from another entity
I don't have much experience with creating triggers but so far this is what I've got
CREATE OR REPLACE TRIGGER o1 BEFORE UPDATE OF get_out ON payment
FOR EACH ROW
BEGIN
UPDATE payment
SET payment.cost = ROUND (24 * (to_date(payment.get_out)-to_date(payment.get_in)),0) *
(SELECT price FROM payment,book,place
WHERE book.ID_place = place.ID_place
AND payment.ID_payment = book.ID_payment
AND payment.ID_payment = :NEW.payment.ID_payment
)
;
END;
/
I get this error when creating the trigger:
Trigger created with compilation errors.
LINE/COL ERROR
---------- -----------------------------------------------------------
7/43 PLS-00049: bad bind variable 'NEW.PAYMENT'
Any suggestion? Thanks