Get the App
SLTechnology News&Howtos  ›  Database  › 

The usage of trim () function

Shulou Source: shulou.com Published: 2022-06-01 15:07:26 10月03日 Update

In oracle, the use of the trim () function is the beginning of leading, the end of trailing, the beginning and end of both, as follows:

Trim (leading | | trailing | | both 'character to be replaced "from" string to be replaced ")

1. The trim function removes the specified opening character.

Select trim (leading 'x' from 'xday') as strTemp from tableName

2. The trim function removes the specified ending character.

Select trim (trailing 'x' from 'dayx') as strTemp from tableName

3. The trim function removes the specified leading and trailing characters

Select trim (both 'x' from 'xdayx') as strTemp from tableName

4. By default, the trim function removes the characters specified by the header and trailer.

Select trim ('x 'from' xdayx') as strTemp from tableName

5. If no character is specified to be removed, the leading and trailing spaces will be removed by default

Select trim ('day') as strTemp from tableName

Tags: Character function tail beginning string case space Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft MariaDB OPPO Reno NVidia Shulou Technology