TD_StrApply Example | Teradata Vantage - TD_StrApply Example - Teradata® Database

Database Analytic Functions

Product
Teradata® Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
Teradata_Vantage™___Advanced_SQL_Engine_Analytic_Functions.withLogo_upload_July2021/wnd1589838592459.ditamap
dita:ditavalPath
Teradata_Vantage™___Advanced_SQL_Engine_Analytic_Functions.withLogo_upload_July2021/ayr1485454803741.ditaval
dita:id
B035-1206
lifecycle
previous
Product Category
Teradata Vantage™

Input Table: input_table

Every complete example in this document is available in a zip file that you can download. The zip file includes a SQL script file that creates the input tables for the examples. If you are reading this document on https://docs.teradata.com/, you can download the zip file from the attachment in the left sidebar.

passenger survived pclass  name                                                sex    age sibsp parch ticket           fare         cabin embarked 
 --------- -------- ------ --------------------------------------------------- ------ --- -----  ----- ---------------- ------------ ----- -------- 
         5        0      3 Allen; Mr. William Henry                            male    35     0     0  373450            8.050000000 null  S       
         4        1      1 Futrelle; Mrs. Jacques Heath (Lily May Peel)        female  35     1     0  113803           53.100000000 C123  S       
         3        1      3 Heikkinen; Miss. Laina                              female  26     0     0  STON/O2. 3101282  7.925000000 null  S       
         1        0      3 Braund; Mr. Owen Harris                             male    22     1     0  A/5 21171         7.250000000 null  S       
         2        1      1 Cumings; Mrs. John Bradley (Florence Briggs Thayer) female  38     1     0  PC 17599         71.283300000 C85   C       


SQL Call

SELECT * FROM TD_strApply ( 
ON strApply_input_table as InputTable PARTITION BY ANY
USING   
TargetColumns ('Sex')
stringOperation ('toUpper') 
Accumulate('Passenger')
InPlace('True')
) as dt order by 1;

Output

passenger sex    
 --------- ------ 
         1 MALE  
         2 FEMALE
         3 FEMALE
         4 FEMALE
         5 MALE