TRIM
- This will trim off unwanted characters from the both sides of string.
- This will remove all the specific characters from both side of string.
Syntax: trim (unwanted_chars from string)
Ex:
select trim( 'i' from 'indiani') from dual;
output ndian
some more example
select trim( ' tech') from dual;
----------------------------------------------------------
tech
select trim( ' ' from ' tech') from dual;
----------------------------------------------------------
tech
select trim( '0' from '000123') from dual;
----------------------------------------------------------
123
select trim( '123' from '123tech1') from dual;
-----------------------------------------------------------
ORA-30001: trim set should have only one character
30001. 00000 - "trim set should have only one character"
*Cause: Trim set contains more or less than 1 character. This is not
allowed in TRIM function.
Because TRIM set should have only one character
select trim( '1' from '123tech1') from dual;
-----------------------------------------------------------
23tech