Prev: if any - sql
Next: logbufsz sizing
From: Damir on 7 Jan 2010 08:04 I looked at the TRANSLATE function, but didn't realize it could be "turned around" to extract the unwanted chars as in your example. Excellent idea, will try it out ASAP. Thank you all on your suggestions! Damir --- "Tonkuma" <tonkuma(a)fiberbit.net> wrote in message news:710d8a5d-058d-4593-b6b9-1a397a72b714(a)l30g2000yqb.googlegroups.com... >> What this UDF does is search the input string for any characters not in >> the >> list of allowed characters (SEARCH_STRING) and replace them with "_". > This may save the heap size. > > Keep blanks as blanks. > CREATE FUNCTION DB2ADMIN.clean_string(in_string VARCHAR(200)) > RETURNS VARCHAR(200) > SPECIFIC CLEAN_STRING > LANGUAGE SQL > DETERMINISTIC > NO EXTERNAL ACTION > CONTAINS SQL > RETURN > TRANSLATE( > in_string > , ' ' > , ' ' || > TRANSLATE(in_string , '' , > '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()* > +,-./:;<=>?_''"') > , '_' > ) > ; |