My table looks like this
+—————-+
| column_name |
+—————-+
| abcOLDdefOLd |
| OLDjklmOLD |
| tuvwxyzOLDOLD|
+—————-+
To change only first occurrence of the string ‘OLD’ into ‘NEW’
we can use following query. (Replace wont work as it replaces all occurrences)
update table_name set column_name=insert(column_name,instr(column_name, ‘OLD’), length(‘OLD’), ‘NEW’);
Now select * from table_name will give output as
+—————-+
| column_name |
+—————-+
| abcNEWdefOLd |
| NEWjklmOLD |
| tuvwxyzNEWOLD|
+—————-+