trim string in oracle sql code example

Example: trim sql oracle

SELECT TRIM('   Exemple   ') FROM dual;						-- 'Exemple'
SELECT LTRIM('   Exemple   ') FROM dual;					-- 'Exemple   '
SELECT RTRIM('   Exemple   ') FROM dual;					-- '   Exemple'
SELECT TRIM(BOTH 'x' FROM 'xxxExemplexxx') FROM dual;		-- 'Exemple'
SELECT TRIM(LEADING 'x' FROM 'xxxExemplexxx') FROM dual;	-- 'Exemplexxx'
SELECT LTRIM('xxxExemplexxx', 'x') FROM dual;				-- 'Exemplexxx'
SELECT TRIM(TRAILING 'x' FROM 'xxxExemplexxx') FROM dual; 	-- 'xxxExemple'
SELECT RTRIM('xxxExemple', 'x') FROM dual;					-- 'Exemplexxx'

Tags:

Sql Example