Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Donald A. Carpenter Fred R. McFadden

1st Edition

8178088045, 978-8178088044

More Books

Students also viewed these Databases questions

Question

Examine various types of executive compensation plans.

Answered: 1 week ago

Question

1. What is the meaning and definition of banks ?

Answered: 1 week ago

Question

2. What is the meaning and definition of Banking?

Answered: 1 week ago

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago

Question

2. How much time should be allocated to the focus group?

Answered: 1 week ago