SUBSTRING Result Type and Attributes - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Here are the default result type and attributes for SUBSTR(string , n1 , n2) and SUBSTRING(string FROM n1 FOR n2):

string Type Result Type
BLOB BLOB(n)
Byte string other than BLOB VARBYTE(n)
CLOB CLOB(n)
Numeric or character string other than CLOB VARCHAR(n)

In ANSI mode, the value of n for the resulting BLOB(n), VARBYTE(n), CLOB(n), or VARCHAR(n) is the same as the original string.

In Teradata mode, the value of n for the result type depends on the number of characters or bytes in the resulting string. To get the data type of the resulting string, use the TYPE function.