stored procedures - mysql replace character at positionGet the solution ↓↓↓
If I have a variable in a stored procedure like this: declare str varchar(10); set str = 'ABCD';
How do I change a character in the string at an arbitrary position? For example: in the procedure x is 3. I need to change str so it becomes str = 'AB*D';
This means that, as x is equals to 3, in the string, the character at the position 3, should be changed to '*'.
You can do this with string manipulations:
select concat(left(str, 2), '*', substring(str, 4, 10))
Or, you can use the
select insert(str, 3, 1, '*')
Share solution ↓
Link To Answer People are also looking for solutions of the problem: call to undefined function mysqli_connect()
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.