TRIM

The Oracle and PL/SQL TRIM function removes all specified characters either from the beginning or the ending of a string.

The general format is:

TRIM(LEADING|TRAILING|BOTH trim_char FROM trim_source)

Example 1:

SELECT TRIM(' JOHN WILLIAMS ') FROM DUAL;

returns:

JOHN WILLIAMS

Example 2:

SELECT TRIM(BOTH ' ' FROM ' JOHN WILLIAMS ') FROM DUAL;

returns:

JOHN WILLIAMS