Solved

DB2 Function LISTAGG failing with SQL0440N

Posted on 2014-12-19
1
1,169 Views
Last Modified: 2015-02-18
We have several DB2 Servers and multiple instances all running DB2 LUW (windows) DB2  V9.7 Fixpack 9

a call to DB2 Function LISTAGG is working against some of the databases - and failing in others.

Here is the SQL:  

SELECT COL1, COL2, LISTAGG(AGT_DESGNT_CD,',') WITHIN GROUP (ORDER BY AGT_DESGNT_CD ) AS AGT_DESGN_DESC
 FROM myschema. mytable
GROUP BY COL1, COL2
ORDER BY COL1, COL2

Here is the error:
Error during Prepare
 42884(-440)[IBM][CLI Driver][DB2/NT] SQL0440N  No authorized routine named "LISTAGG" of type "FUNCTION" having compatible arguments was found.  SQLSTATE=42884

I cannot find a pattern as to why it is failing in some databases and not in others.   On one Server, I have 2 Databases - both in the same instance - and it is failing in one and not the other.
0
Comment
Question by:itsonlyme4
1 Comment
 
LVL 45

Accepted Solution

by:
Kdo earned 500 total points
ID: 40510770
Hi me,

Functions in DB2 look a lot like functions in object oriented languages in that the same function name can be used over and over.

SQL0440N  No authorized routine named "LISTAGG" of type "FUNCTION" having compatible arguments was found.  SQLSTATE=42884

The error that you're seeing indicates that there is no definition of LISTAGG that has a matching parameter type list.  That is, it may exist with parameters (varchar, varchar), but not (int, varchar).


Check the version of DB2 on all of the servers.  It may be that DB2 on the server that's giving you trouble is older than the others and LISTAGG isn't in the system library.

Check the system library (sysibm) and make sure that LISTAGG is defined there.

LISTAGG is recursive.  It could be that the result is longer than the default limit of 4000 characters.  (Though I would expect a different error.)  Try recasting the source name.  DB2 recursive SQL propogates the source length through the entire query.

  LISTAGG(CAST(AGT_DESGNT_CD AS VARCHAR(10000)), ',')


Good Luck,
Kent
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

November 2009 Recently, a question came up in the DB2 forum regarding the date format in DB2 UDB for AS/400.  Apparently in UDB LUW (Linux/Unix/Windows), the date format is a system-wide setting, and is not controlled at the session level.  I'm n…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now