Friday, 1 April 2016

SQL TRIM

This will trim off unwanted characters from the both sides of string.

     Syntax: trim (unwanted_chars from string)

     Ex:
          SQL> select trim( 'i' from 'indiani') from dual;

TRIM(
-----
ndian
        
SQL> select trim( leading'i' from 'indiani') from dual; -- this will work as LTRIM

TRIM(L
------
ndiani


SQL> select trim( trailing'i' from 'indiani') from dual; -- this will work as RTRIM

TRIM(T
------
Indian

No comments:

Post a Comment