I need to replace a particular character from each in oracle.
For example:
cadena= '12121113'
and what I need is to change the "1" to a "2" but only the "1" that is in position 3.
and return me the modified result.
As a result it should remain '12221113'
.
I hope I have explained myself well.
With this query it will look at the third "case when" value is equal to 1.
SUBSTR functions
If the result is true, then the first part of the substring is concatenated, then the part to be changed is concatenated, and then it is concatenated with the end of its string.
If false, then true will be returned.
As an alternative I leave you the following code. you can make use of instr
and the query would be the following
Reuben
This way is shorter than the previous ones, but the key is in the regular expressions, I'm sure there must be an even shorter solution with a single regular expression.