2022-07-17 681
oracle怎么去掉前后的空格
在oracle中,trim()函数的用法有,leading 开头字符,trailing 结尾字符,both 开头和结尾字符,如下:
trim(leading || trailing || both '将要被替换掉的字符" from “将要被替换的字符串")
1、trim函数去除指定的开头字符
select trim(leading 'x' from 'xday') as strTemp from tableName ;
2、trim函数去除指定的结尾字符
select trim(trailing 'x' from 'dayx') as strTemp from tableName ;
3、trim函数去除指定的首部和尾部字符
select trim(both 'x' from 'xdayx') as strTemp from tableName ;
4、默认情况下,trim函数会去除首部和尾部,被指定的字符
select trim('x' from 'xdayx') as strTemp from tableName ;
5、如果没有指定被移除的字符,则会默认去除首部和尾部的空格
select trim(' day ') as strTemp from tableName ;
扩展知识:
语法描述如下:
TRIM([ { { LEADING | TRAILING | BOTH } [ trim_character ] | trim_character } FROM ] trim_source )
参数解释:
leading 开头字符
trailing 结尾字符
both 开头和结尾字符
trim_character 去除的字符
trim_source 修剪源
原文链接:https://77isp.com/post/2062.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态