Teradata String ManipulationTeradata 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 FunctionThe UPPER and LOWER functions convert the character column values all in uppercase and lowercase, respectively. UPPER and LOWER are ANSI compliant. Syntax Example The following example will convert the "Robert" string in the upper case string. After executing the above code, it will give the following output. ROBERT Now in the same example, we will convert the same "ROBERT" string in the lower case string. Output robert CHARACTER_LENGTH FunctionThe CHARACTER_LENGTH function returns the numbers of characters of a character string expression.
Syntax Example 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. 6 TRIM FunctionThe TRIM function is used to remove space a particular set of leading or trailing or both from an expression. TRIM is ANSI standards. Syntax Example 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. Robert POSITION FunctionThe 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. Syntax Example 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. 4 SUBSTRING FunctionThe SUBSTRING function is used to return a specified number of characters from a particular position of a given string. SUBSTRING function is ANSI standard. Syntax It returns a string (str), starting at the position (pos), and length (len) in characters. Example 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. Rob
Next TopicTeradata Date/Time Functions
|