Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2008
    Posts
    29

    Unanswered: DB2 Functions Queries

    What are the rules for folloiwng 2 function scenarios,

    1) we can not write two or more functions in same select statement?
    2) we can not use nested functions like sum(avg(salary)) group by
    employee_id?

    Please give link explaining in detail for this will be more helpful.
    If you having any docs for this then mail it to denisvenis@gmail.com


    Thanks,
    Denis.

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    It probably depends on which functions you are talking about. You can certainly use 2 or more functions, or nested functions, for many of the functions, but there may limitations on the ones that require some arithmetic.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    What does "we can not ..." mean? Do you get an error message or other results than what you expect?

    An expression like "SUM(AVG(salary))" is syntactically possible, of course. But the SUM() is not needed because it won't change the result at all. So it really depends on what you want to achieve.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  4. #4
    Join Date
    Dec 2005
    Posts
    273
    Quote Originally Posted by stolze
    An expression like "SUM(AVG(salary))" is syntactically possible, of course.
    An aggregate function must not include another aggregate function. SQLCODE = -112

Posting Permissions

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