globomike wrote:
I am looking for a function (or hint) how I can count unicode
characters (and not bytes) in DB2 V8.2.
In DB2 9 the length function is extenced with the codeunits32 option -
and this is exactly what I need in DB2 V8.2.
I would write a simple Java UDF that takes the string as input and counts
the number of characters. Something like this (completely untested) should
do:
import java.lang.*; // for String class
import COM.ibm.db2.app.UDF; // UDF classes
public class UnicodeCharCount extends UDF
{
public void charCount(String str, int count) throws Exception
{
if (str != null) {
set(2, str.length());
}
}
}
--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany