Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2002
    Location
    Minneapolis, MN
    Posts
    253

    Unanswered: 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..."

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    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.

  3. #3
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    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.

  4. #4
    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..."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •