Friday, October 10, 2014

PeopleSoft :: RTRIM IN Oracle

The RTRIM function can be used in the following versions of Oracle/PLSQL:
Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i

EXAMPLE

Let's look at some Oracle RTRIM function examples and explore how to use the RTRIM function in Oracle/PLSQL.

1)RTRIM('Peoplesoft        ')
Result:Peoplesoft
2)RTRIM('Peoplesoft        ', '    ')
Result:Peoplesoft
3)RTRIM('1230000', '0')
Result:123
4)RTRIM('Peoplesoft123123', '123')
Result:Peoplesoft
5)RTRIM('123Peoplesoft123', '123')
Result:123Peoplesoft
6)RTRIM('Techxyxzyyy', 'xyz')
Result: 'Tech'
7)RTRIM('Tech6372', '0123456789')
Result: 'Tech'

The RTRIM function may appear to remove patterns, but this is not the case as demonstrated in the following example.RTRIM('Techxyxxyzyyyxx', 'xyz') Result: 'Tech'

It actually removes the individual occurrences of 'x', 'y', and 'z', as opposed to the pattern of 'xyz'.
The RTRIM function can also be used to remove all trailing numbers as demonstrated in the next example.RTRIM('Tech6372', '0123456789') Result: 'Tech'

No comments:

Post a Comment