Teradata – String Manipulation

Teradata provides several functions to manipulate the strings. These functions are compatible with ANSI standard.

Sr.NoString Function & Description
1||Concatenates strings together
2SUBSTRExtracts a portion of a string (Teradata extension)
3SUBSTRINGExtracts a portion of a string (ANSI standard)
4INDEXLocates the position of a character in a string (Teradata extension)
5POSITIONLocates the position of a character in a string (ANSI standard)
6TRIMTrims blanks from a string
7UPPERConverts a string to uppercase
8LOWERConverts a string to lowercase

Example

Following table lists some of the string functions with the results.

String FunctionResult
SELECT SUBSTRING(‘warehouse’ FROM 1 FOR 4)ware
SELECT SUBSTR(‘warehouse’,1,4)ware
SELECT ‘data’ || ‘ ‘ || ‘warehouse’data warehouse
SELECT UPPER(‘data’)DATA
SELECT LOWER(‘DATA’)data

Leave a Reply