Question: 3. (a) Write a script that uses an anonymous block of PL/SQL code to declare a variable called total_product_quantity and set it to the
3. (a) Write a script that uses an anonymous block of PL/SQL code to declare a variable called total_product_quantity and set it to the total quantity of a product with ID: 1001 in the order_details table. If the total quantity is greater than 1, then the block should display a message that says, "The product has more than 1 in quantity." Otherwise, the block output should say "The product has only 1 in quantity." Make sure that you set the server output to be on before the PL/SQL block of code and include that at the top of your submission. (b) Delete the record that has an order number of 10068 and product id of 1001 from the order_details table. Do NOT commit. (c) Run your PL/SQL again. You should get a different output. (d) Rollback your deletion.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
