Home » SQL & PL/SQL » SQL & PL/SQL » AVG() on a nested table (Oracle 10g)
AVG() on a nested table [message #308824] Tue, 25 March 2008 10:21 Go to next message
vjnair
Messages: 5
Registered: March 2008
Junior Member
Hi,

I have created a nested table of type number the type being defined globally. I populate the values into the table and then i need to calculate the average of that.

Any ideas as to how to go about this. This is my query

SELECT AVG() INTO v_avg_nav FROM TABLE(v_tt_nav);

I donno what to pass into the AVG() method ?

Thanks...Vijay
Re: AVG() on a nested table [message #308826 is a reply to message #308824] Tue, 25 March 2008 10:25 Go to previous message
ThomasG
Messages: 3212
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
What is the column called when you run a

select * FROM TABLE(v_tt_nav);

?

When I used such casts it is usually called COLUMN_VALUE. Then a

SELECT AVG(COLUMN_VALUE) INTO v_avg_nav FROM TABLE(v_tt_nav);


will work.

[Updated on: Tue, 25 March 2008 10:28]

Report message to a moderator

Previous Topic: Derived table access
Next Topic: What is the Main Difference b/w synonym and public synonym?
Goto Forum:
  


Current Time: Sat Feb 08 20:22:56 CST 2025