(Database)
How do I rewrite this trigger code to be a row level trigger? after writing, test the code by inserting a new row.
CREATE OR REPLACE TRIGGER UPDATE_ORDERS
AFTER INSERT OR UPDATE OF Units, Price ON ORDERS
FOR EACH ROW
BEGIN
UPDATE ORDERS
SET new.Total = Units*Price;
END;
*For reference, this is the code for the orders table:
CREATE TABLE ORDERS(
ORDERNO INTEGER PRIMARY KEY,
PRODUCT VARCHAR(20),
UNITS INTEGER,
PRICE NUMBER, TOTAL NUMBER);
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here