Oracle can you really use the Ltrim/rtrim function?

Source: Internet
Author: User
Tags rtrim

The common use is to remove the space, how many people do not know that they can actually do to remove the space, it has LTrim (), LTrim (x, Y) method

-------   go to both spaces, go left space, go right space    --------Select trim ('    x-rapido    ') name from dual;   Return ' X-rapido ' select LTrim ('    x-rapido    ') name from dual;  Return ' X-rapido    ' select RTrim ('    x-rapido    ') name from dual;  Returns '    x-rapido ' select trim (NULL) name from dual;   Returns null


LTrim (x, y) syntax

The LTrim (x, y) function truncates the characters in X by one of the characters in Y, and executes from the left, as long as the characters in Y are encountered, the characters in X are truncated until the function command ends in the characters of X that are not in Y.

Select LTrim (' Abcdabababe ', ' ab ') word from dual;

Results: Cdabababe

Select LTrim (' aaaaaa ', ' a ') word from dual;

Result: null empty

Select LTrim (' 109224323 ', ' 109 ') nums from dual;

Results: 224323

Select LTrim (' 10900094323 ', ' 109 ') nums from dual;

Results: 4323

Select LTrim (' 10900111000991110224323 ', ' 109 ') nums from dual;

Results: 224323

Select LTrim (' 109200111000991110224323 ', ' 109 ') nums from dual;

Results: 200111000991110224323

Select LTrim (' 902100111000991110224323 ', ' 109 ') nums from dual;

Results: 2100111000991110224323


Note: Oracle is case sensitive

Select LTrim (' Abcdab ', ' B ') word from dual;

Results: Abcdab


As for the RTrim function, as with LTrim, one starts from the left and one from the right.


The ability to intercept a string differs from the SUBSTR function because one is a specified character, and the other is defined as the


Oracle Do you really use the Ltrim/rtrim function?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.