Example: Using TRIM Functions - 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™

The following table illustrates several more complicated TRIM functions.

Function Result
SELECT TRIM(LEADING 'a' FROM 'aaabcd'); 'bcd'
CREATE TABLE t2

  (i1 INTEGER, c1 CHAR(6), c2 CHAR(1));

INSERT t2 (1, 'aaabcd', 'a');

SELECT TRIM(LEADING c2 FROM c1) FROM t2;

'bcd'
CREATE TABLE t3

  (i1 INTEGER, c1 CHAR(6) CHAR SET UNICODE);

INSERT t3 (1, _Unicode '006100610061006200630064'XC);

SELECT TRIM(LEADING _Unicode '0061'XC FROM t3.c1);

'bcd'
SELECT TRIM(_Unicode 'ΔΔ abc ΔΔΔ '); 'abc '
SELECT TRIM(_Unicode 'ΔΔ abc ΔΔ Δ '); 'abc ΔΔ '

Δ (GRAPHIC pad) is not removed.

CREATE TABLE t1

  (c1 CHARACTER(6) CHARACTER SET GRAPHIC);

INSERT t1 (_Graphic 'abc ΔΔ ');

SELECT TRIM(c1) from t1;

'abc '

Δ (GRAPHIC pad) is removed because the operand of the TRIM function is of type GRAPHIC.