TRIM
TRIM([LEADING | TRAILING | BOTH]
     [trim_character FROM] string)

Removes both leading and trailing spaces (or other character) from a string.

Parameters

LEADING

Specifies that only leading spaces be trimmed.

TRAILING

Specifies that only trailing spaces be trimmed.

BOTH

Specifies that both leading and trailing spaces be trimmed.

trim_character

Specifies some other character to trim instead of a space.

string

Specifies the input string.

Examples

SQL> SELECT TRIM('   TEENA   ') FROM dual;

TRIM(
-----
TEENA

SQL> SELECT TRIM(LEADING '$' FROM '$123.45') FROM dual;

TRIM(L
------
123.45

Get Oracle SQL: the Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.