oracle数据库中如何去除空格

目前,我所知道的就有两种方法:

一、trim(a)--只能去除字符串左右的空格

select trim(leading from ' ——11—— ') aa from dual;

select trim(trailing from ' ——11—— ') aa from dual;
select rtrim(' ——11—— ') aa from dual;
select ltrim(' ——11—— ') aa from dual;
select trim('1' from '1xxxxWORLDxxxx1') aaaaa from dual;

二、replace(a,b,c)--去除字符串里的全部空格
select replace(' aa kk ',' ','') abcd from dual;
select replace('我 爱 我 的 小 女 神',' ','') from dual;

猜你喜欢

转载自www.cnblogs.com/liuguozhen/p/8920863.html