Sample Header Ad - 728x90

DB2: Why does translate function also replace spaces?

1 vote
1 answer
3113 views
I would like to remove control characters (HEX \x00 until \x7F) from a DB2 data base field. For this I tried to apply the following translate-function: TRANSLATE(field, 'X', x'000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F') It does work for control chracters, but the function also translates question marks, and I don't understand why? Interestingly question marks are not replaced by "X" like the control characters but by a space \x20. Why does it behave like that? Original values: Text View: mhlkm Hex: 6D 68 6C 6B 6D 3F Text View in Hex Viewer: mhlkm? Translated values: Text View: mhlkm Hex: 6D 68 6C 6B 6D 20 Text View in Hex Viewer: mhlkm
Asked by user3193317 (149 rep)
Jul 18, 2018, 10:42 AM
Last activity: Jul 18, 2018, 01:08 PM