LTRIM、RTRIM和TRIM在ORACLE中的用法
来源:互联网 发布:网络银行的特点 编辑:程序博客网 时间:2024/06/05 09:46
转自:http://www.cnblogs.com/gsk99/archive/2011/04/25/2027359.html
LTRIM、RTRIM和TRIM在ORACLE中的用法:
1、LTRIM(C1,C2)其中C1和C2都可以字符串,例如C1是'Miss Liu',C2'MisL'等等。这是第一个和SQL SERVER不一样的地方。如果记得不错的话SQL Server的LTRIM只有一个参数,作用是去掉字符串左面的空格。而Oracle的LTRIM则是保证C1的第一个字符不能出现在C2字符串中。
SQL> select LTRIM( 'Miss Liu', 'Liu') Result from dual;
RESULT
--------
Miss Liu
SQL> select LTRIM( 'Miss Liu', 'M is') result from dual;
RES
---
Liu
从上述就可以看出LTRIM的作用。但是如果第二个字符串不进行输入,那么LTRIM的作用和SQL SERVER中就相同,就是去掉左面的空格。
SQL> select ltrim( ' Miss Liu ' ) result from dual;
RESULT
----------
Miss Liu
SQL> select length( ' Miss Liu ' ) len1, length( ltrim( ' Miss Liu ' ) ) lentrim from dual;
LEN1 LENTRIM
---------- ----------
12 10
由上述可以看出Oracle的LTrim的功能应该更强大一些,能够对前导符进行操作。
2、RTRIM的功用和LTRIM相同,但是RTRIM修改成了从右向左的,这样子就是去掉后导符中的特定字符。
3、TRIM的功能如下描述:
In Oracle/PLSQL, the trim function removes all specified characters either from the beginning or the ending of a string.
The syntax for the trim function is:
trim( [ leading | trailing | both [ trim_character ] ] string1 )
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.
If none of these are chosen (ie: leading, trailing, both), the trim function will remove trim_string from both 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 from string1.
string1 is the string to trim.
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
上面的这些都已经被验证了,其中leading trailing和Both后面的From不可省略
- LTRIM、RTRIM和TRIM在ORACLE中的用法:
- LTRIM、RTRIM和TRIM在ORACLE中的用法
- ORACLE中的LTRIM、RTRIM和TRIM
- oracle中trim,ltrim,rtrim函数用法
- oracle中trim,ltrim,rtrim函数用法
- oracle中trim,ltrim,rtrim函数用法
- oracle中trim,ltrim,rtrim函数用法
- oracle trim() ltrim() rtrim()
- 关于ltrim,rtrim,和trim的用法
- Oracle之TRIM、LTRIM和RTRIM
- Oracle ltrim rtrim trim函数
- oracle 的trim ,ltrim, rtrim
- oracle中trim,rtrim,ltrim
- LTrim、RTrim 和 Trim 函数
- LTrim、RTrim 和 Trim 函数
- LTrim、RTrim 和 Trim 函数
- LTrim、RTrim 和 Trim 函数
- oracle中trim,ltrim,rtrim函数的不同用法
- subView的添加与移除
- 群联MPALL v3.23.00量产工具(可刷PS2251-50固件)
- Win7 +CUDA5.0 + Visual Studio 2010 的环境配置
- 设置保护眼睛颜色
- ORACLE全局索引、分区索引
- LTRIM、RTRIM和TRIM在ORACLE中的用法
- row_number() OVER(PARTITION BY)函数介绍
- 设计模式(十九)----- 观察者模式(Observer)----(JAVA版)
- Java线程池的调用
- MyEclipse+Tomcat web项目改名
- tmote设计(三) - CC2420(exposed die attach pad)
- Android开发:在onTouchEvent中处理任意时间的长按事件
- GridView实现选取多条记录并删除
- printf、sprintf与fprintf 的区别