mysql将数据库中手机号前面的0去掉
UPDATE appeal
SET phone = substring( phone, 2, LENGTH( phone ) - 1 )
WHERE
LENGTH( phone ) > 11
或者select cast(tt as UNSIGNED) from test;
如果是身份证号就只能先转成数字在转成字符串
oracle数据库中:
去除字符串前面或者后面多余的0
-
--去掉字符串后面多余的0
-
select rtrim('10011000000', '0');
-
运行结果:10011
-
--去掉字符串前面多余的0
-
select ltrim('000100110000', '0');
-
运行结果:100110000