regex - Oracle declare select into update statement does not work -
i had issue due database charset special characters weird codes assigned them, getting select ascii(substr(declinereasondesc, 30,1)) declinereason t declinereasonid = 7;
got code (49827) £
in db charset. tried update records in database.
problem getting data not saved db or selecting into
value varchar2(6);
somehow changes , not match regexp_replace
any-more.
it did error when tried using varchar2(1)
should value, hint.
declare c varchar2(6); begin select ascii(substr(declinereasondesc, 30,1)) c declinereason t declinereasonid = 7; begin update declinereason set declinereasondesc = regexp_replace(declinereasondesc, '(.+)('||c||')(\d+)', '\1\3 (gbp)'); commit; end; end; / commit;
update: tried declare c number;
no errors didn't update values ether
this 1 caused me being stupid - forgot wrap c
in chr(c)
.
declare c number; begin select ascii(substr(declinereasondesc, 30,1)) c declinereason t declinereasonid = 7; begin update declinereason set declinereasondesc = regexp_replace(declinereasondesc, '(.+)('||chr(c)||')(\d+)', '\1\3 (gbp)'); commit; end; end; / commit;
Comments
Post a Comment