STRTOK Function Example | Teradata Vantage - Example: Using STRTOK - Analytics Database - Teradata Vantage

SQL Functions, Expressions, and Predicates

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-01-12
dita:mapPath
obm1628111499646.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
kby1472250656485
lifecycle
latest
Product Category
Teradata Vantageā„¢

Consider the following table and inserted data.

   CREATE TABLE t (id INTEGER, str VARCHAR(256));
   INSERT INTO t VALUES (1,'Teradata-Warehouse 13.10 - Combine 2 powerful forms of business intelligence (BI).'); 
   INSERT INTO t VALUES (2,'http://www.teradata.com/');

The following query returns the third token from the t.str string value. There are only two tokens in the second string, so the function returns NULL for that row.

SELECT id, STRTOK(t.str, ' -/', 3) FROM t;

The output from the query is:

         id  STRTOK(str,' -/',3)
-----------  ----------------------------------------------------------
          1  13.10
          2  NULL