trim函數如何整列?
在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 ;
上一篇淘寶電腦端主頁怎么編輯