Rpj
Rpj

Reputation: 6080

How to remove a certain character from a column in a table

I have the following records in my table

insert into table foo values (1, '200{');
insert into table foo values (2, '20090{');
insert into table foo values (3, '220{');
insert into table foo values (4, '2000{');
insert into table foo values (5, '5000');

I want to replace all rows and remove the "{" character, there are more than 10K records in my table with such a violation. Note: id=5 doesn't have it.

Upvotes: 0

Views: 33

Answers (1)

juergen d
juergen d

Reputation: 204756

update foo
set column_2 = replace(column_2, '{', '')
where locate(column_2, '{') > 0

Upvotes: 1

Related Questions