oracle中去除空格一般用rtim、ltrim,但是不能用这两个去除tab,这时可以
update BAS_Forwarding set SOURCEONCE=replace(SOURCEONCE,chr(09),'') where warehouseid like '111%';
chr(09)是tab的ascii码
csv文件导入oracle后,存在大量的tab,这时可以用游标批量去除tab:
declare
v_colunm_name varchar2(30);
cursor c1 is SELECT column_name FROM user_tab_columns where table_name = upper('BAS_Forwarding');
begin
open c1;
loop --提取一行数据到c1
fetch c1 into v_colunm_name;
--判读是否提取到值,没取到值就退出
--取到值c_job%notfound 是false
--取不到值c_job%notfound 是true
exit when c1%notfound;
update BAS_Forwarding set SOURCEONCE=replace(SOURCEONCE,chr(09),'') where warehouseid like '111%';
end loop;--关闭游标
commit;
exception
when others then
dbms_output.put_line('出错'||sqlerrm);
rollback;
close c1;
end;