TRIM() Function

If trimType is not specified, it will default to trimming BOTH. That means that empty spaces will be stripped from both ends of the string.

— Trim() without a tripType specified
SELECT TRIM(‘ Monday ‘) AS Both_Sides
FROM DUAL;

–TRIM type set to BOTH
SELECT TRIM(BOTH ‘ ‘ FROM ‘ Monday ‘)
FROM DUAL;

— TRIM TYPE Set to Leading
SELECT TRIM(LEADING ‘ ‘ FROM ‘ Monday ‘) AS TRIMMED
FROM DUAL;

— TRIM TYPE Set to TRAILING
SELECT TRIM(TRAILING ‘ ‘ FROM ‘ Monday ‘)
FROM DUAL;

— TRIM a character from a string
SELECT TRIM(‘y’ FROM ‘Monday’)
FROM DUAL;

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top