PL/SQL Trim

Oracle PL/SQL Trim Function

The Trim function removes all specified characters from the beginning or from the ending of a string.

The Trim Function syntax:

trim( [ leading | trailing | both [ trim_character ] ] string )

Leading – remove trim_character from the front of string.

Trailing – remove trim_character from the end of string.

Both – remove trim_character from the front and end of string.

Example

select trim(' test ') from dual; 

would return 'test'


select trim(leading '0' from '0004560') from dual;

would return '4560'


select trim(trailing '6' from 'Forms6') from dual;

would return 'Forms'


select trim(both '3' from '3Tutorial333') from dual;

would return 'Tutorial'