问题描述
我需要在一组 400k+ 字符串记录中查找并清理换行符、回车符、制表符和SUB"字符,但是这个 DB2 环境对我造成了影响.
I need to find and clean up line breaks, carriage returns, tabs and "SUB"-characters in a set of 400k+ string records, but this DB2 environment is taking a toll on me.
以为我可以用 REPLACE() 和 CHR() 函数进行一些搜索和替换,但似乎 CHR() 在此系统上不可用(错误:*LIBL 类型 *N 中的 CHR 未找到).使用 、、 等似乎也不起作用.字符可以位于字符串的中间或末尾.
Thought I could do some search and replacing with the REPLACE() and CHR() functions, but it seems CHR() is not available on this system (Error: CHR in *LIBL type *N not found). Working with , , etc doesn't seem to be working either. The chars can be in the middle of strings or at the end of them.
DBMS = DB2
System = iSeries
Language = SQL
Encoding = Not sure, possibly EBCDIC
关于我可以用这个做什么的任何提示?
Any hints on what I can do with this?
推荐答案
如果你想清除回车 (EBCDIC x'0d') 和换行 (EBCDIC x'25') 等特定字符,你应该找到 EBCDIC 中的翻译字符 然后使用 TRANSLATE() 函数将它们替换为空格.
If you want to clear up specific characters like carriage return (EBCDIC x'0d') and line feed (EBCDIC x'25') you should find the translated character in EBCDIC then use the TRANSLATE() function to replace them with space.
如果您只想删除无法显示的字符,请查找 x'40' 以下的任何内容.
If you just want to remove undisplayable characters then look for anything under x'40'.
这篇关于DB2/iSeries SQL 清理 CR/LF、制表符等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!