var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Update a specific character in a string.
I want to update a character in a specific position in a string. So I might have 'AAAAA' and I want to update the 3rd character to 'B' giving 'AABAA'
On informix is trivial..
* update table1 set col1= 'B'
But on Oralce.. it seems the only way is...
* update table1 set col1 = substr(col1,1,2) || 'B' || substr(col1,4);
So the question is... is this truely the only way I can do this Oracle? Or is ther some function I am not aware of that will help.
Yes, that's the only way (and I don't know any RDBMS where this can be done differently)
SQL> select regexp_replace('AAAAA', '[[:alpha:]]', 'B', 3, 1) result
2 from dual;
Oracle supports regular expressions. select regexp_replace('AAAAA','*','B',3,1) from dual;
The 'AAAAA' can be replaced by a column name, and dual can be replaced by your table name.
The '*' is a pattern match, and I used an asterisk for all.
The 'B' is what you want the new value to be.
The 3 is the position to start checking. You said you wanted to check the 3rd position.
The 1 is the occurrence. You only want to replace the 3rd character, not every 3rd character.
Excellent, thanks for the responses, all very useful...