Home » SQL & PL/SQL » SQL & PL/SQL » Newbie Needs Help - How to Calc Average without Aggregate Function
Newbie Needs Help - How to Calc Average without Aggregate Function [message #38577] Sun, 28 April 2002 07:24 Go to next message
Ms. Newbie
Messages: 2
Registered: April 2002
Junior Member
This question has me stumped - it's probably really easy but not for me! It reads:

"Create an anonymous PL/SQL block that will report the average standard price for all items in the price table. You must NOT use any SQL aggregate functions or cursor FOR loops. You should use explicit cursor(s) and numeric output must be limited to 2 decimal places."

The column name is STDPRICE and the table name is price. I know how to declare the cursor, the PL/SQL table if needed - not sure what variables to use and how to create the loop to add all the column values. And can I use cursor_name%ROWCOUNT to divide by to get the average?

Totally frustrated - kindly need help. Personally I say if the Oracle Gods made Aggregate Functions we should use them!!!!!!!!! Thanks, Ms. Newbie (name withheld to protect my identity from prof! ha!)
Nevermind! I actually got it! [message #38581 is a reply to message #38577] Sun, 28 April 2002 21:18 Go to previous message
Ms. Newbie
Messages: 2
Registered: April 2002
Junior Member
Thanks to anyone who read my message and thought about helping. I actually got the solution tonight!
Previous Topic: Multiple rows query
Next Topic: How to change the table name?
Goto Forum:
  


Current Time: Thu Apr 25 02:07:16 CDT 2024