Navigation:  NexusDB Guide > SQL Reference > SQL Functions > String Value Functions >

Trim Function

Previous pageReturn to chapter overviewNext page

NexusDB V3 Manual

Trim Function

button_main button_prev button_next

NexusDB Manual V3 > SQL Reference > SQL Functions > String Value Functions

Syntax

 

<trim function> ::=

 

 

 

TRIM ( [ [ <trim specification> ] [ <trim character> ] FROM ] <trim source>

<trim specification> ::=

 

 

|

|

 

LEADING

TRAILING

BOTH

<trim character> ::= <character value expression>

 

<trim source> ::= <character value expression>

 

 

Notes

 

§

The TRIM function removes leading and/or trailing characters from the source string.

 

§

If no trim specification is specified, then BOTH is implicit.

 

§

If no trim character is specified, then space is implicit.

 

§

If the declared type of the trim source is a fixed-length or variable-length character string type, then the data type of the result is CHARACTER VARYING or NATIONAL CHARACTER VARYING with a length equal to the fixed length or maximum variable length of the trim source, otherwise the data type of the result is CHARACTER LARGE OBJECT or NATIONAL CHARACTER LARGE OBJECT.

 

§

If either of the arguments are null, then the result is null.

 

 

Examples

 

 

Expression

 

 

Result

 

TRIM( ' Meet the Dream Team ' )

'Meet the Dream Team'

TRIM( BOTH FROM ' Meet the Dream Team ' )

'Meet the Dream Team'

TRIM( LEADING 'M' FROM 'Meet the Dream TeaM' )

'eet the Dream TeaM'

TRIM( TRAILING 'M' FROM 'Meet the Dream TeaM' )

'Meet the Dream Tea'

TRIM( BOTH 'M' FROM 'Meet the Dream TeaM' )

'eet the Dream Tea'

 


Conformance

 

SQL:2003 standard

-

Core SQL

 

© Nexus Database Systems Pty Ltd.

nexus_logo