If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Missing Functions

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-04-04, 12:09
ansonee ansonee is offline
Registered User
 
Join Date: Feb 2002
Location: Minneapolis, MN
Posts: 253
Missing Functions

I was trying to ruin a simple query checking the avreage of a column:

SELECT AVG(<COLUMN_NAME>) FROM <TABLE_NAME>

Got the folowing error:
[IBM][CLI Driver][DB2/NT] SQL0440N No authorized routine named
"AVG" of type "FUNCTION" having compatible arguments was found.
SQLSTATE=42884

I thought functions were just inhereent?!? I checked and don't see any AVG function owned by SYSIBM. Nor do I see MAX, MIN, etc.

Did someone not set up our database wrong?
__________________
Anthony Robinson

"If I'm curt with you, it's because time is a factor here. I think fast, I talk fast, and I need you guys to act fast if you want to get out of this. So, pretty please - with sugar on top..."
Reply With Quote
  #2 (permalink)  
Old 05-04-04, 12:34
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
What is the column type you pass as the parm ? The column type shoud be numneric ?

This should work

with temp(a,b) as
(
values(1,1),(2,2),(3,3)
)

select avg(a) from temp
;


HTH

Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 05-04-04, 12:35
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by ansonee
I was trying to ruin a simple query
It looks like you've succeeded :-)

That error message could also be an indication of an incompatible column type being supplied to the function. Try CASTing the column to something numeric.
Reply With Quote
  #4 (permalink)  
Old 05-04-04, 14:49
ansonee ansonee is offline
Registered User
 
Join Date: Feb 2002
Location: Minneapolis, MN
Posts: 253
I did, I did ruin a simple query!!!

My goof - incompatible column type. Chose the wrong column - works like a charm.

Please feel free to ridicule at will....
__________________
Anthony Robinson

"If I'm curt with you, it's because time is a factor here. I think fast, I talk fast, and I need you guys to act fast if you want to get out of this. So, pretty please - with sugar on top..."
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On