-1

遇到了一个问题,由于数据库字符集特殊字符会被分配给它们的奇怪代码,然后通过让select ascii(substr(declinereasondesc, 30,1)) from DECLINEREASON t where declinereasonid = 7;£在 db 字符集中得到代码(49827)。然后我尝试更新数据库中的记录。

我得到的问题是数据没有保存到数据库或selecting into值以varchar2(6);某种方式更改它并且它不再匹配REGEXP_REPLACE

当我尝试使用varchar2(1)which should value 时它确实出错了,这可能是一个提示。

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;没有错误但没有更新值以太

4

1 回答 1

0

这是我愚蠢造成的 - 忘记换行cchr(c)

declare c number;
begin 
select ascii(substr(declinereasondesc, 30,1)) into c from DECLINEREASON t
where declinereasonid = 7;
begin 
  update DECLINEREASON set declinereasondesc = REGEXP_REPLACE(declinereasondesc, '(.+)('||chr(c)||')(\d+)', '\1\3 (GBP)');
  commit;
  end;
end;
/
  commit;
于 2014-11-19T12:50:10.990 回答