As a shopper selects products on the Brewbeans\' site, a procedure is needed to
ID: 3891267 • Letter: A
Question
As a shopper selects products on the Brewbeans' site, a procedure is needed to add a newly selected item to the current shopper's basket. Create a procedure named BASKET_ADD_SP that accepts a product ID, basket ID, price, quantity, size code option (1 or 2), and form code option (3 or 4) and uses this information to add a new item to the BB_BASKETITEM table. The table's PRIMARY KEY column is generated by BB_IDBASKETITEM_SEQ. Run the procedure with the following values:
Basket ID—14
Product ID—8az
Price—10.80
Quantity—1
Size code—2
Form code—4
Explanation / Answer
Please find the Stored Procedure Code below:-
CREATE OR REPLACE PROCEDURE BASKET_ADD_SP (
V_PRODUCT_ID IN BASKET.PRODUCT_ID%TYPE,
V_BASKET_ID IN BASKET.BASKET_ID%TYPE,
V_PRICE IN BASKET.PRICE%TYPE,
V_QUANTITY IN BASKET.QUANTITY%TYPE,
V_SIZE_CODE IN BASKET.SIZE_CODE%TYPE,
V_FORM_CODE IN BASKET.FORM_CODE%TYPE)
IS
BEGIN
INSERT INTO BB_BASKETITEM (ITEM_ID,PRODUCT_ID, BASKET_ID, PRICE, QUANTITY, SIZE_CODE,FORM_CODE VALUES(BB_IDBASKETITEM_SEQ.NEXTVAL,V_PRODUCT_ID, V_BASKET_ID, V_PRICE, V_QUANTITY, V_SIZE_CODE, V_FORM_CODE);
COMMIT;
END;
/
# To Execute the Stored Procedure "BASKET_ADD_SP"
EXECUTE BASKET_ADD_SP('8az', 14, 10.80, 1, 2, 4);
Please let me know in case of any clarifications required. Thanks!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.