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