SQL homework 3
Create a PL/SQL program that handles the order placement for the application described in Project 1. When customer Newton decides to buy, all the items in his shopping cart that are not in the wish list will be included in a purchase order. The following actions take place:
1. If there are items in the shopping cart for Newton, a new row is inserted in the ORDERS table. Increment the order ID of the new row accordingly.
2. For each item in the SHOPPING_CART_ITEMS that is in Newton’s buying list (not in the wish list) do the following:
a. A corresponding item is created in the ORDER_ITEMS table. All these newly added order items refer to the order created in step 1.
b. The quantity in INVENTORY_ITEMS table is updated accordingly
3. All the items in the SHOPPING_CART_ITEMS table that were just ordered are removed
Add a few output lines using DBMS_OUTPUT.PUT_LINE function to indicate how your program progresses through the list of actions.
Submit the PL/ SQL program as a text file (.txt) following the document naming convention FirstnameLastnameHW3.txt.
Grading
|
15 points |
Variable declarations |
|
25 points |
Proper use of the FOR LOOP to iterate through the Shopping Cart items |
|
20 points |
Proper creation of a new order (avoid empty orders) |
|
10 points |
Order item insertion for each product in the Shopping Cart of user Newton |
|
10 points |
Inventory update for each ordered product |
|
10 points |
Product items removal from the Shopping Cart |
|
10 points |
Use of output debug lines |