The Oracle/PLSQL TRIM function removes all specified characters either from the beginning or the ending of a string.
ORACLE TRIM SYNTAX
The syntax for the Oracle/PLSQL TRIM function is:
TRIM( [ leading | trailing | both [ trim_character ] string1 )
PARAMETERS OR ARGUMENTS
leading - remove trim_string from the front of string1.
trailing - remove trim_string from the end of string1.
both - remove trim_string from the front and end of string1.
trim_character is the character that will be removed from string1. If this parameter is omitted, the TRIM function will remove all leading and trailing spaces fromstring1.
string1 is the string to trim.
NOTE
If you do not choose a value for the first parameter (leading, trailing, both), the TRIM function will remove trim_string from both the front and end of string1.
APPLIES TO
The TRIM function can be used in the following versions of Oracle/PLSQL:
- Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i, Oracle 8i
ORACLE TRIM EXAMPLE
Let's look at some Oracle TRIM function examples and explore how you would use the TRIM function in Oracle/PLSQL.
For example:
| TRIM(' tech ') | would return 'tech' |
| TRIM(' ' from ' tech ') | would return 'tech' |
| TRIM(leading '0' from '000123') | would return '123' |
| TRIM(trailing '1' from 'Tech1') | would return 'Tech' |
| TRIM(both '1' from '123Tech111') | would return '23Tech' |
本文介绍了 Oracle/PLSQL 中的 TRIM 函数,该函数用于从字符串的开头或结尾移除指定字符。文章详细解释了 TRIM 函数的语法、参数及用法,并提供了多个示例帮助理解。
2323

被折叠的 条评论
为什么被折叠?



