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中的用法:相关推荐

  1. mysql中ltrim用法_LTrim、RTrim 和 Trim 函数的功能及用法

    TRIM 函数是用来移除掉一个字串中的字头或字尾.最常见的用途是移除字首或字尾的空白.这个函数在不同的资料库中有不同的名称: MySQL: TRIM(), RTRIM(), LTRIM() oracl ...

  2. ORACLE 中ROWNUM用法总结!

    ORACLE 中ROWNUM用法总结! 对于 Oracle 的 rownum 问题,很多资料都说不支持>,>=,=,between...and,只能用以上符号(<.<=.!=) ...

  3. oracle中何时会用到join,Oracle中join用法的演示

    以下的文章主要介绍的是Oracle中join用法,如果你是其方面的新手,对Oracle中oin的实际用法很感兴趣,但是却找不到一些资料去对其进行更深入的了解的话,你不妨浏览以下的文章对其进行了解. O ...

  4. oracle中using用法,Oracle中Using用法

    Oracle中Using用法 1.静态SQLSQL与动态SQL Oracle编译PL/SQL程序块分为两个种:其一为前期联编(early binding),即SQL语句在程序编译期间就已经确定,大多数 ...

  5. oracle中%type用法,oracle中declare用法

    第8 章 函数与存储过程 Oracle数据库中不仅可以使用单条语句对数据库进行 数据库中不仅可以使用单条语句对数据库进行 查操作,而且可以多条语句组成一个语句块, 增.删.改.查操作,而且可以多条语句 ...

  6. Oracle中union用法

    Oracle中union用法 一.union用于查询结果可能存在多张表中的数据,并剔除重复数据据. 二.union all 用于查询结果可能存在多张表中的数据,并将所有数据返回. 三.写法: sele ...

  7. oracle trim没用,Oracle中Trim函数的使用方法

    TRIM函数最简单的功能就是使用它来去除字符串的行首和行尾的空格,这个功能也是大家使用频率最高的一种.然而在Oracle中TRIM函数其实是具有删除"任意指定"字符的功能,下面就进 ...

  8. Oracle中rownum用法警示

    今天调试代码,发现分页查询时使用Oracle中rownum的between......and用法的bug,特此总结: 参考资料:http://blog.csdn.net/lg312200538/art ...

  9. oracle中$的用法,关于expdp 中query用法小结

    今天看到群里有人问到关于在使用expdp导出数据中使用query参数报错的解决方法,自己也出于好奇心瞎折腾了一把,现记录如下 1.第一次尝试的时候[oracle@DB ~]$ expdp scott/ ...

最新文章

  1. position属性及实现图片垂直居中
  2. 深度学习——人工神经网络再掀研究热潮
  3. RHEL5.4安装Oracle-10g
  4. boost::spirit模块实现一个雇员结构的解析器的测试程序
  5. 2013年上半年 中级数据库工程师
  6. SIP协议栈基础笔记
  7. A+B Problem(再升级)
  8. android通讯录加密,Android获取通讯录并上传(包含通讯录加密)
  9. Python经典前端框架:Django,第一天【Django环境搭建】
  10. 自动控制原理分析工作原理以及方框图做题过程
  11. Bootstrap栅格系统(屏幕大小)
  12. ZenCart商店 OpenzcTPL模版安装教程
  13. Stepping Number
  14. PW系列 | palette 体验
  15. 2020 中秋、国庆快乐!
  16. 太让人失望了,这些公司建议避雷!
  17. web前端如何做注册页面
  18. 南土所褚海燕组综述微生物组学的技术和方法及其应用
  19. Cmd批处理替换文件
  20. 网络安全通识全解|第12期 《网络安全审查办法》解读

热门文章

  1. 产品经理这个角色真的泡沫越来越大吗?
  2. 【专访】PP租车张丙军:“打虎亲兄弟“,好团队才能书写互联网传奇
  3. Windows Phone的网络连接策略
  4. 《Java程序设计》终极不改版【下】
  5. bat批处理延迟运行脚本
  6. 301. Remove Invalid Parentheses
  7. NHibernate Step by Step (一) 转载
  8. 将 Web 项目从 Visual Studio .Net 2002/2003 转换到 Visual Studio 2005 的分步指南
  9. 在RHEL上实现OpeenSSH
  10. springCloud(22):Eureka总结提升