SQL rtrim usage

Source: Internet
Author: User
Tags rtrim

 
The following describes the function in OCP.
Rtrim (<C1>, <c2>) takes two arguments, where c1 and c2 are character
Strings. This function returns C1 without any trailing characters that appear
In C2. if no C2 characters are trailing characters in C1, then C1 is returned
Unchanged. C2 defaults to a single space.
There is no doubt that rtrim has removed the null string on the right of the string.
The question is how the string is processed on the right.
For example:
Select rtrim ('mississipp', 'IP') test1, rtrim ('rpadded') Test2, rtrim ('mississipp', 'sips') test3 from dual;
Result:
Test1 test3 test3
Mississ rpadded m
Implementation of test1
First, search for any character in 'IP' from the right side of 'Mississippi '. In this example, It is' I ', 'P ', until the 'Mississippi 'is not' I 'or 'P' characters on the right side, the result should be mississ
Implementation of Test2
Removes spaces from the string.
Implementation of test3
The implementation method is the same as test1. First, search for any character in 'sips' from the right side of the string 'mississipp'. In this example, the characters are 's', 'I', 'P ', until the 'Mississippi 'is not 's',' I ', or 'P' characters on the right side, the result should be m
The following example shows the rtrim function.
Select rtrim ('mississipp', 'misp') test1, rtrim ('mississipp', 'I') Test2 from dual;
Test1 Test2
Mississipp

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/rfb0204421/archive/2008/12/02/3430916.aspx

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.