Some interesting SQL Enhancements:
* Pass ROWs and ARRAY's of ROWs between
JDBC and SQL Procedures and Functions
* LIKE with non constant patterns (e.g. LIKE as a "join predicate")
* Multi-Action triggers (One trigger for UPDATE/INSERT/DELETE)
* Allow UPDATE/DELETE/INSERT/MERGE in BEFORE triggers
Enjoy
Serge
--
Serge Rielau
SQL Architect DB2 for LUW, IBM Toronto Lab
Blog: tinyurl.com/SQLTips4DB2
Wiki: tinyurl.com/Oracle2DB2Wiki
Twitter: srielau
Sounds like it's time for a new sequel in the "SQL on Fire!"
series... ;-)
--
Jeroen
Cheers
"The LISTAGG function aggregates a set of string values for the group
into one string by appending the string-expression values based on the
order specified in the WITHIN GROUP clause."
So no more feeling special because you know how to do it with
XMLAGG? :-(
Joking, nice release...
--
Frederik Engelen
For DB2 Express C FP4 I propose asking the question in the Express C
forum. I'd be surprised if there were no refresh.
9.7.4 for is now availible for download
/Lennart
http://www.dbforums.com/db2/1666067-how-get-change-ip-middle-session.html
During installation it created the a new SAMPLE database which worked
just fine and the sample LISTAGG command from the info center works
just great. Problem is however that trying the same command (slightly
different syntax of course) in my existing database (ex 9.7.2) fails
with :
SQL0440N No authorized routine named "LISTAGG" of type "FUNCTION"
having
compatible arguments was found. SQLSTATE=42884
Is there some upgrade command, access to grant, permission to set,
bind to perform or something similar I am missing in order to get this
new function working on my existing database ?
On 05/03/2011 11:00 AM, Fin wrote:
> Is there some upgrade command, access to grant, permission to set,
> bind to perform or something similar I am missing in order to get this
> new function working on my existing database ?
After applying a fixpak, you usually use the following steps to upgrade
the db.
db2updv9 -d <dbname>
db2 BIND ~/sqllib/bnd/@db2ubind.lst GRANT PUBLIC BLOCKING ALL
db2 BIND ~/sqllib/bnd/@db2cli.lst GRANT PUBLIC BLOCKING ALL
db2 BIND ~/sqllib/bnd/db2schema.bnd BLOCKING ALL GRANT PUBLIC sqlerror
continue
Try those steps and your LISTAGG should be available.
--
Helmut K. C. Tessarek
DB2 Performance and Development
IBM Toronto Lab
That did the trick, problem solved.
Cheers, Fin.
Refer support to me directly.
A workaround may be LAG and NULLIF, like...
------------------------------ Commands Entered
------------------------------
SELECT workdept
, COUNT(*) AS members
, SUBSTR(
LISTAGG( VARCHAR( NULLIF(edlevel , lag_edlevel) ) , ' ' )
WITHIN GROUP(ORDER BY edlevel)
, 1 , 20 ) AS distinct_edlevel
FROM (SELECT e.*
, LAG(edlevel)
OVER(PARTITION BY workdept
ORDER BY edlevel) AS lag_edlevel
FROM employee e
) e
GROUP BY
workdept
;
------------------------------------------------------------------------------
WORKDEPT MEMBERS DISTINCT_EDLEVEL
-------- ----------- --------------------
A00 3 14 18 19
B01 1 18
C01 3 16 18 20
D11 9 16 17 18
D21 6 14 15 16 17
E01 1 16
E11 5 12 14 16 17
E21 4 14 16
8 record(s) selected.
I'm quite new to DB2 and using Express-C only so I don't know how to
open PMR (which seems to be available to customers only).