Limited support BMC provides limited support for this version of the product. As a result, BMC no longer accepts comments in this space. If you encounter problems with the product version or the space, contact BMC Support.BMC recommends upgrading to the latest version of the product. To see documentation for that version, see BMC AMI Command Center for Db2 13.2

TRANSLATE function


The TRANSLATE function returns a fixed or varying character string that has a value in which one or more characters of the first argument might have been converted to other characters.

TRANSLATE.png

Important

The TRANSLATE function is not supported for Index on Expression. 

The arguments are defined as follows:

stringExpression

stringExpression is an expression that specifies the string to be converted. stringExpression must return a value that is a built-in single-byte character string data type. stringExpression cannot be a string constant.

toString

toString is a fixed-length character constant that is assumed to be in the same encoding scheme as the stringExpression. The translate function might not work correctly if the encoding schemes are not the same. The maximum length of toString is 256 characters.

If you specify toString you must also specify fromString. If the length of toString is less than the length of fromString ,toString is padded to the length of fromString with the pad or a blank. If the length of toString is greater than fromString, the extra characters in toString are ignored without warning.

fromString

fromString is a fixed-length character constant that is assumed to be in the same encoding scheme as the stringExpression. The translate function may not work correctly if the encoding schemes are not the same. Alternatively, you can specify the character constant as a hexadecimal constant. The maximum length of fromString is 256 characters.

pad

pad character is optional and defaults to an EBCDIC blank. You can specify pad as a character string constant or hexadecimal constant with a length not exceeding one character.

fromString is considered the input translate table, tablei. toString is the output translate table, tableo.

Important

If only string expression is specified, the translate function is treated as an UPPER function.

If the argument can be null, the result can be null; if the argument value is null, the result is the null value.

TRANSLATE searches tablei for each character in stringExpression. If it finds the character, the corresponding character in tableo is used in the result string; if tablei contains duplicates, TRANSLATE uses the first (leftmost) occurrence . If it does not find the character, then TRANSLATE uses the original character in string. The result string is always the same length as string.






 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*