0 ';
EXECUTE IMMEDIATE V_sql
into cnt;
if cnt > 0 then
v_sql := 'update temp set ' || colname || '=trim(replace(' || colname ||
',chr(10),''''))' || 'where instr(' || colname ||
',chr(10))>0 ';
EXECUTE IMMEDIATE V_sql;
commit;
end if;
--替换回车符chr(13)
v_sql := 'select count(1) from temp where instr(' || colname ||
',chr(13))>0 ';
EXECUTE IMMEDIATE V_sql
into cnt;
if cnt > 0 then
v_sql := 'update temp set ' || colname || '=trim(replace(' || colname ||
',chr(13),chr(13))>0 ';
EXECUTE IMMEDIATE V_sql;
commit;
end if;
--替换'|' chr(124) 为'*' chr(42)
v_sql := 'select count(1) from temp where instr(' || colname ||
',chr(124))>0 ';
EXECUTE IMMEDIATE V_sql
into cnt;
if cnt > 0 then
v_sql := 'update temp set ' || colname || '=replace(' || colname ||
',chr(124),chr(42))' || 'where instr(' || colname ||
',chr(124))>0 ';
EXECUTE IMMEDIATE V_sql;
commit;
end if;
end loop;
end PROC_test;
/
以上所述是小编给大家介绍的Oracle删除字段中的空格、回车及指定字符的实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对编程之家网站的支持!
原文链接:https://www.f2er.com/oracle/64935.html