【发布时间】:2015-01-16 23:48:33
【问题描述】:
我 had an issue where due to database charset special characters would get weird codes assigned 给他们,然后通过获取 select ascii(substr(declinereasondesc, 30,1)) from DECLINEREASON t
where declinereasonid = 7; 我在 db 字符集中获得了 £ 的代码 (49827)。然后我尝试更新数据库中的记录。
我遇到的问题是数据没有保存到 DB 或 selecting into 值以某种方式更改为 varchar2(6); 并且它不再匹配 REGEXP_REPLACE。
当我尝试使用应该值的varchar2(1) 时出错,这可能是一个提示。
declare c varchar2(6);
begin
select ascii(substr(declinereasondesc, 30,1)) into c from DECLINEREASON t
where declinereasonid = 7;
begin
update DECLINEREASON set declinereasondesc = REGEXP_REPLACE(declinereasondesc, '(.+)('||c||')(\d+)', '\1\3 (GBP)');
commit;
end;
end;
/
commit;
更新:尝试declare c number;没有错误但没有更新值ether
【问题讨论】:
-
where语句中没有where子句?!? -
@ammoQ 不需要它,不匹配的 regex_replace 返回它的输入值。
-
但这仍然意味着更新语句仍然会影响
DECLINEREASON中的所有行,即使更新本身没有效果 -
@ammoQ 你说的很对
标签: regex oracle select-into regexp-replace