数据库表 test 字段 id name age
全角数字:1234
半角数字:1234
length和lengthb的区别:
length(1234) 4
lengthb(1234) 8
to_single_byte函数用法:
to_single_byte(1234) 1234
查找所有全角的数字:
select age from test where lengthB(age) >4
替换全角的为半角的:
update test t1 set t1.age = (select to_single_byte(t2.age) from test t2 where t1.id = t2.id)