Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this part we will learn how to use functions: 1.Create a functions that has the Customer_id as input and returns a number that represents

In this part we will learn how to use functions:

1.Create a functions that has the Customer_id as input and returns a number that represents the total cost of orders for this customer. Notice that you will need to multiply the Order_Qty from table order_details and the Unit_Price from table items to get the total cost of each order.

2. Now use the function: Write a select statement that selects all the customers and the total cost of the orders they have ever made.

3.

In this part we create a small procedure:

a.Write a procedure that has as input the customer_id. Then the procedure should delete the corresponding customer from table customers.

B.Notice that customer_id is a foreign key on table orders. Therefore the customer cannot be deleted if he has placed orders. To delete a record from customers you should first delete the corresponding orders and to do that you need to first delete the corresponding order_details.

C.Now execute the procedure to delete customer with id 1. If you have solved part 01 a record will be inserted into Customer_Archives.

D.ROLLBACK; and all these changes will be undone

On Oracle selDeveloper

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

Database Management An Organizational Perspective

Authors: Richard T. Watson

1st Edition

0471305340, 978-0471305347

More Books

Students also viewed these Databases questions

Question

2. Why has the conflict escalated?

Answered: 1 week ago