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
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