Question: Create and test a stored procedure called prc_inv_delete that takes an invoice number variable as a parameter and deletes the invoice number passed in to

 Create and test a stored procedure called prc_inv_delete that takes an

invoice number variable as a parameter and deletes the invoice number passed

in to it from the table INVOICE. The code for this procedure

Create and test a stored procedure called prc_inv_delete that takes an invoice number variable as a parameter and deletes the invoice number passed in to it from the table INVOICE. The code for this procedure and test cases are given below [note that we are doing a ROLLBACK; at the end). CREATE OR REPLACE PROCEDURE PRC_INV_DELETE (W_IN IN NUMBER) AS IF W_IN IS NOT NULL THEN DELETE FROM INVOICE WHERE INV_NUMBER = W_IN; END IF; END; BEGIN / COMMIT; /* Test Cases */ SELECT * FROM INVOICE WHERE INV_NUMBER IN (1001, 1008); SELECT * FROM LINE WHERE INV_NUMBER IN (1001, 1008); EXEC prc_inv_delete (1001); EXEC prc_inv_delete (1008); SELECT FROM INVOICE WHERE INV_NUMBER IN (1001, 1008); SELECT FROM LINE WHERE INV_NUMBER IN (1001, 1008); ROLLBACK; 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. The code for this trigger and test cases are given below. CREATE OR REPLACE TRIGGER trg_prod_20H_on_line_add BEFORE INSERT ON LINE FOR EACH ROW BEGIN UPDATE P_QOH P_QOH : NEW.LINE UNITS WHERE PRODUCT.P_CODE = :NEW.P_CODE; PRODUCT SET END; COMMIT; You will test your trigger by inputting the following commands into the same file [note that we are doing a ROLLBACK; at the end]: SELECT P_CODE, P_QOH FROM PRODUCT WHERE P_CODE="54778-2T'; FROM LINE WHERE P_CODE='54778-2T"; INSERT INTO LINE VALUES (1005, 2, '54778-2T', 12,5.87); SELECT P_CODE, P_QOH FROM PRODUCT WHERE P_CODE='54778-2T'; SELECT * FROM LINE WHERE P_CODE='54778-2T'; SELECT ROLLBACK; Create and test a stored procedure called prc_inv_delete that takes an invoice number variable as a parameter and deletes the invoice number passed in to it from the table INVOICE. The code for this procedure and test cases are given below [note that we are doing a ROLLBACK; at the end). CREATE OR REPLACE PROCEDURE PRC_INV_DELETE (W_IN IN NUMBER) AS IF W_IN IS NOT NULL THEN DELETE FROM INVOICE WHERE INV_NUMBER = W_IN; END IF; END; BEGIN / COMMIT; /* Test Cases */ SELECT * FROM INVOICE WHERE INV_NUMBER IN (1001, 1008); SELECT * FROM LINE WHERE INV_NUMBER IN (1001, 1008); EXEC prc_inv_delete (1001); EXEC prc_inv_delete (1008); SELECT FROM INVOICE WHERE INV_NUMBER IN (1001, 1008); SELECT FROM LINE WHERE INV_NUMBER IN (1001, 1008); ROLLBACK; 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. The code for this trigger and test cases are given below. CREATE OR REPLACE TRIGGER trg_prod_20H_on_line_add BEFORE INSERT ON LINE FOR EACH ROW BEGIN UPDATE P_QOH P_QOH : NEW.LINE UNITS WHERE PRODUCT.P_CODE = :NEW.P_CODE; PRODUCT SET END; COMMIT; You will test your trigger by inputting the following commands into the same file [note that we are doing a ROLLBACK; at the end]: SELECT P_CODE, P_QOH FROM PRODUCT WHERE P_CODE="54778-2T'; FROM LINE WHERE P_CODE='54778-2T"; INSERT INTO LINE VALUES (1005, 2, '54778-2T', 12,5.87); SELECT P_CODE, P_QOH FROM PRODUCT WHERE P_CODE='54778-2T'; SELECT * FROM LINE WHERE P_CODE='54778-2T'; SELECT ROLLBACK

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!