Question

In PL/SQL, With a single query, display the average number of days that each part spent in transit. Round the answers to...

In PL/SQL, With a single query, display the average number of days that each part spent in transit. Round the answers to a whole day

the columns are ( PartNo, Shipdate, ArriveDate)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

From below pl/sql , we can find average number of days each part spent in transit

declare
2 part_no ship.PartNo%type;
3 ship_date ship.Shipdate%type;
4 arrival_date ship.ArrivalDate%type;

5 avg_ship ship.PartNo%type;
6 CURSOR c_ship is
7 SELECT PartNo,Shipdate,ArrivalDate, AVG(ArrivalDate-Shipdate) FROM ship;
8 BEGIN
9 OPEN c_ship;
10 LOOP
11 FETCH c_ship into part_no, ship_date, arrival_date;
12 EXIT WHEN c_ship%notfound;
13 dbms_output.put_line(avg_ship);
14 END LOOP;
15 CLOSE c_ship;
16 END;
17 /

Add a comment
Know the answer?
Add Answer to:
In PL/SQL, With a single query, display the average number of days that each part spent in transit. Round the answers to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT