How to remove spaces in oracle database

Currently, as far as I know, there are two methods:

1. trim(a) -- only remove spaces around the string

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;

2. replace(a,b,c)--remove all spaces in the string
select replace(' aa kk ',' ','') abcd from dual;
select replace('I love my little goddess',' ','') from dual;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324719078&siteId=291194637