Teradata String Manipulation
Teradata provides several functions to manipulate the strings. These functions are compatible with the ANSI standard.
Teradata String Functions are also supported most of the standard string functions along with the Teradata extension to those functions.
UPPER & LOWER Function
The UPPER and LOWER functions convert the character column values all in uppercase and lowercase, respectively. UPPER and LOWER are ANSI compliant.
The following example will convert the "Robert" string in the upper case string.
After executing the above code, it will give the following output.
Now in the same example, we will convert the same "ROBERT" string in the lower case string.
The CHARACTER_LENGTH function returns the numbers of characters of a character string expression.
The following example will return the number of characters of the "Robert" string.
Execute the above code, and it tells the length of the "Robert" string as the output shown below.
The TRIM function is used to remove space a particular set of leading or trailing or both from an expression. TRIM is ANSI standards.
The following example removes the space from both the end of the "Robert" string.
When we execute the above code, it will trim the existing space from both ends of the string and gives the following output.
The POSITION function is used to return the position of a substring inside the string. The position of the first occurrence of the string is returned only.
The following example will return the occurrence of "e" in the "Robert" string.
After executing the above code, it will find the position of "e" substring in the "Robert" string as output.
The SUBSTRING function is used to return a specified number of characters from a particular position of a given string. SUBSTRING function is ANSI standard.
It returns a string (str), starting at the position (pos), and length (len) in characters.
The following example returns the character from the 1st position for 3 characters.
The above code returns 3 characters from the 1st position of the string "Robert" as the output.
Next TopicTeradata Date/Time Functions