The translate function returns a string that results from:
Characters in a selection string correspond positionally to characters in a substitution string. The first character in the selection string corresponds to the first character in the substitution string, the second corresponds to the second, and so forth.
Example:
If the selection string contains the letter A in its tenth position, each occurrence of A in the original string is replaced by the tenth character in the substitution string.
Syntax:
►►─┬─ TRANS ─────┬─ (string, substitution-string ─┬─────────────────────┬─ ) ─►◄ └─ TRANSLATE ─┘ └─ ,selection-string ─┘
Invocation names:
TRANS TRANSLATE
Parameters:
Specifies the variable on which the translate function is performed.
Specifies the substitution string.
Specifies the selection string (optional):
Example:
This example translates all occurrences of 1, 2, and 3 in course ID values to A, B, and C, respectively. The initial value of COURSE-ID is '321 '.
select trans(course-id,'123','abc') from course-list ' CBA '
|
Copyright © 2013 CA.
All rights reserved.
|
|