Question: Question: Develop a Stored Procedure for the query below. (In Oracle) Develop two solutions: 1. Use EXEC statement to call the stored procedures. 2. Use
Question: Develop a Stored Procedure for the query below. (In Oracle)
Develop two solutions:
1. Use EXEC statement to call the stored procedures.
2. Use a Anonymous Block as a driver program to call the stored procedure and return result to driver program and display them. You should produce the same result as the SQL query is generating and with similar format.
SELECT O.EMPLOYEE_NO AS EMPLOYEE_NO, RANK() OVER(ORDER BY COUNT(O.CUSTOMER_NO)) AS NUM_ORDERS , RANK() OVER(ORDER BY COUNT(DISTINCT O.CUSTOMER_NO)) AS NUM_CUSTOMERS FROM ORDERS O GROUP BY O.EMPLOYEE_NO HAVING COUNT(DISTINCT O.CUSTOMER_NO) > (SELECT ROUND(AVG(A.COUNT),1) FROM( SELECT COUNT(DISTINCT CUSTOMER_NO) AS COUNT FROM ORDERS GROUP BY EMPLOYEE_NO)A) ORDER BY NUM_ORDERS DESC, NUM_CUSTOMERS DESC;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
