Question
generate_order_id () This function do not have any parameters. It finds the maximum order ID in the orders table and increase it by 1 as
generate_order_id ()
This function do not have any parameters. It finds the maximum order ID in the orders table and increase it by 1 as new order ID. The function returns the new order ID to the caller.
customer_order (customerId IN NUMBER, orderId IN OUT NUMBER)
This procedure receives two values as customer ID and Order ID and confirms if there exists any order with this order ID for this customer in the orders table. If the order ID with this customer ID exists, the procedure passes the order ID to the caller. Otherwise, it passes 0 to the caller.
display_order_status(orderId IN NUMBER, status OUT orders.status%type)
This procedure has an input parameter to receive an order ID and an output parameter to pass the status of the order to the caller. IF the receiving order ID exists, the procedure stores the order status in the status variable. If the order ID does not exists, store null in the status variable.
cancel_order (orderId IN NUMBER, cancelStatus OUT NUMBER)
This procedure has an input parameter to receive an order ID and an output parameter to pass a value to the caller. IF the receiving order ID exists, the procedure stores the value of the column status in a variable orderStatus. If orderStatus is 'Canceled', the procedure stores 1 in to the parameter cancelStatus. If the orderStatus is shipped, the procedure stores 2 in to the parameter cancelStatus. Otherwise, it stores 3 in to the parameter cancelStatus and updates the status of that order to "Canceled". If the order ID does not exists, it stores 0 in the cancel variable.
The cancelStatus parameter gets the following values:
0: The order does not exit.
1: The order has been already canceled.
2: The order is shipped and cannot be canceled.
3: The order is canceled successfully.
The stored procedure does not print any outputs.
The question is to write these 3 procedures and function according to the description given per each in order to compile them correctly.
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