背景:
在日常的工作中, 经常会出现查询的表中存在带有空格的字段值的,所以我们需要将空格去掉;
create table t_ab ( id varchar2(32) not null, name varchar2(200), xm varchar2(150), );
首先去查询是否存在空格的数据
select * from t_ab t where t.name like '% %';
然后根据查出来的带空格的数据去掉空格
UPDATE t_ab t SET t.name = REPLACE(t.name,' ','') where t.name like '% %';
到此去空格就完成了。