Question

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

SQL Triggers: PO4 OTSE OS PIANE IS INITIA AS ACTICE GUS ANONE QUS BALNE PROE VONTACT TOTT UUS HOE INY DATE V PHONE UC UNITS B

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

Answer)

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

EXPLANATION

When we insert a new row in the table, in trigger we catch it by :NEW keyword. SO in this I use that, when a new insert is happened in LINE table, just that time, P_QOH = :NEW.LINE_UNITS+P_QOH, it means that P_QOH is updated in the product table by the value inserted(NEW.LINE_UNITS) with the old value of PQH in product table.

Add a comment
Know the answer?
Add Answer to:
SQL Triggers: PESOFT P NOTE POO IS DOCE ESTE GIS DAN DISINI OS ARRANCE US PHONE...
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: ARE VARELA VSA LINE NTS LINE RPHE DATE DU MEADDE Create a trigger named...

    SQL Triggers: ARE VARELA VSA LINE NTS LINE RPHE DATE DU MEADDE Create a trigger named trg prod QOH_on_line_update that will automatically update the product quantity on hand for a product when a corresponding product LINE row is updated. A template has been created for you below for this trigger. Fill in the ... areas with the proper code: CREATE OR REPLACE TRIGGER trg prod_QOH_on_line_update BEFORE UPDATE ON LINE FOR EACH ROW BEGIN UPDATE SET WHERE END; COMMIT;

  • 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'); /*...

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