Question
The company that you work for wants to create a review process for orders that were CANCELLED or REFUNDED as the ORDER_STATUS in the Order
The company that you work for wants to create a review process for orders that were CANCELLED or REFUNDED as the ORDER_STATUS in the Order table shows. Create a view in the PL/SQL command window by copying and pasting this code: CREATE OR REPLACE VIEW vw_incomplete_orders AS SELECT o.order_id,order_status,to_char(order_datetime,'MM/DD/YYYY') OrderDate,store_id,product_id,(unit_price * quantity) AS MoneyLost FROM orders o ,order_items oi WHERE o.order_id = oi.order_id AND o.order_status <> 'COMPLETE'; Run the code to create the view.
Create an instead of trigger named TRGR_INCOMPLETE_ORDERS that will fire when the ORDER_STATUS in the vw_incomplete_orders VIEW is updated to REVIEWED. Have the trigger delete from the ORDER_ITEMS and ORDERS table based on order_id. Use the bind variable :new.ORDER_STATUS. Use an IF/END IF block to check the updated order status.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started