Question

SQL Triggers: ARE VARELA VSA LINE NTS LINE RPHE DATE DU MEADDE Create a trigger named trg prod QOH_on_line_update that will a

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The Sql statement for creating a trigger that will automatically update the product quantity on hand for a product when a corresponding product LINE row is updated.

CREATE OR REPLACE TRIGGER trg_prod_QOH_on_line_update
BEFORE UPDATE ON LINE
FOR EACH ROW
BEGIN
   UPDATE PRODUCT
   SET P_QOH = P_QOH + :NEW.LINE_UNITS
   WHERE P_CODE = :NEW.P_CODE;
END;
/
COMMIT;  

The above trigger is fired whenever a row in LINE table is updated and the product's quantity on hand in Product table is updated i.e the LINE_UNITS in LINE table are added to P_QOH field in PRODUCT table for that product.

Add a comment
Know the answer?
Add Answer to:
SQL Triggers: ARE VARELA VSA LINE NTS LINE RPHE DATE DU MEADDE Create a trigger named...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • SQL Triggers: PESOFT P NOTE POO IS DOCE ESTE GIS DAN DISINI OS ARRANCE US PHONE...

    SQL Triggers: PESOFT P NOTE POO IS DOCE ESTE GIS DAN DISINI OS ARRANCE US PHONE QUS BALANCE WOO PARCE P DISCOUNT V OGLE VALE VONTACT VAREATCOS VEMONE V SAE VORCER SED IN DATE P ORDE UNE UNITS UPER BP NE BPNTAL PP 14 DATE VENTA DE BP VOR Create a trigger called named trg_prod QOH_on_line_add that will automatically update the product quantity on hand for a product when a corresponding product LINE row is added. We end a trigger...

  • 1. This trigger is from Figure 16.2 of the text. Copy and run this trigger so it is created in th...

    1. This trigger is from Figure 16.2 of the text. Copy and run this trigger so it is created in the ap database. You can run the UPDATE below to test it. Notice two things. The error message appears as a pink screen just like a syntax error would. Also, if you then query the invoices table, the UPDATE statement did not execute. The trigger prevented the erroneous UPDATE from changing the data.                 DELIMITER // CREATE TRIGGER invoices_before_update    BEFORE UPDATE...

  • PL/SQL Auction Program 1. Create a user xyz, who is the owner of the auction. Create...

    PL/SQL Auction Program 1. Create a user xyz, who is the owner of the auction. Create the schema, and package. 2. Create users x1 and x2 who are the participants in the auction. They will need acces to the package. 3. Bid on the same item and record your observations. Verify all scenarios. Upload the files with the missing code and a detailed sample run. AUCTION OWNER.TXT SQL> conn / as sysdba Connected. SQL> drop user xyz cascade; User dropped....

  • Create SQL statements based on the given tables: Code to create the tables: CREATE DATABASE LAB...

    Create SQL statements based on the given tables: Code to create the tables: CREATE DATABASE LAB4DB; USE LAB4DB; CREATE TABLE CUSTOMER ( CUS_CODE int primary key, CUS_LNAME varchar(15), CUS_FNAME varchar(15), CUS_INITIAL varchar(1), CUS_AREACODE varchar(3), CUS_PHONE varchar(8), CUS_BALANCE float(8) ); INSERT INTO CUSTOMER VALUES('10010','Ramas','Alfred','A','615','844-2573','0'); INSERT INTO CUSTOMER VALUES('10011','Dunne','Leona','K','713','894-1238','0'); INSERT INTO CUSTOMER VALUES('10012','Smith','Kathy','W','615','894-2285','345.86'); INSERT INTO CUSTOMER VALUES('10013','Olowski','Paul','F','615','894-2180','536.75'); INSERT INTO CUSTOMER VALUES('10014','Orlando','Myron','','615','222-1672','0'); INSERT INTO CUSTOMER VALUES('10015','O''Brian','Amy','B','713','442-3381','0'); INSERT INTO CUSTOMER VALUES('10016','Brown','James','G','615','297-1228','221.19'); INSERT INTO CUSTOMER VALUES('10017','Williams','George','','615','290-2556','768.93'); INSERT INTO CUSTOMER VALUES('10018','Farriss','Anne','G','713','382-7185','216.55'); INSERT INTO CUSTOMER VALUES('10019','Smith','Olette','K','615','297-3809','0'); /*...

  • How can we assess whether a project is a success or a failure? This case presents...

    How can we assess whether a project is a success or a failure? This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT