0
To replace the third character of a string in Firebird, example: 00028 by 00128, 00029 by 00129... Someone could help me, I tried to see by replace, but I can’t determine the position
0
To replace the third character of a string in Firebird, example: 00028 by 00128, 00029 by 00129... Someone could help me, I tried to see by replace, but I can’t determine the position
2
Firebird has the overlay function.
overlay ('00029' placing '1' from 3)
Site with documentation and more examples: overlay
Another example would be to oracle, where it is possible to use a expressão regular
.
SELECT regexp_replace('00029','(^.{2})(.{1})(.*)$','\1X\3') FROM dual;
In this case, I put a "X" to mark where the new number should be inserted. The first {2}
is the position of the exchange and the {1}
is the number of letters to be replaced.
Browser other questions tagged sql firebird
You are not signed in. Login or sign up in order to post.
Dear thanks Reinaldo, I did not know this function of Firebird, it worked right, vlw
– Naaliel Corrêa