104. TRIM - llighter/database GitHub Wiki
TRIM Oracle Help Center
Syntax

Purpose
TRIM enables you to trim leading or trailing characters (or both) from a character string. If trim_character or trim_source is a character literal, then you must enclose it in single quotes.
-
If you specify
LEADING, then Oracle Database removes any leading characters equal totrim_character. -
If you specify
TRAILING, then Oracle removes any trailing characters equal totrim_character. -
If you specify
BOTHor none of the three, then Oracle removes leading and trailing characters equal totrim_character. -
If you do not specify
trim_character, then the default value is a blank space. -
If you specify only
trim_source, then Oracle removes leading and trailing blank spaces. -
The function returns a value with datatype
VARCHAR2. The maximum length of the value is the length oftrim_source. -
If either
trim_sourceortrim_characteris null, then theTRIMfunction returns null.
Examples
SELECT employee_id,
TO_CHAR(TRIM(LEADING 0 FROM hire_date))
FROM employees
WHERE department_id = 60;
EMPLOYEE_ID TO_CHAR(T
----------- ---------
103 3-JAN-90
104 21-MAY-91
105 25-JUN-97
106 5-FEB-98
107 7-FEB-99