我这里有个问题。在我的数据库中,我在mobile_phone列中有值,比如628932323,但是我想更改使用62 to 0的每一行
old value : 628932323
new value : 08932323有人能帮我解决我的问题吗?谢谢
发布于 2012-10-31 16:26:28
如果您使用的是oracle 10g或更高版本,则可以使用regexp_replace函数http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions130.htm
select regexp_replace(your_column, '62([:digit:]*)', '0\2')
from your_table;或者是一种更老式的方式:
select case
when your_column like '62%' then '0' || substr(your_column, 3)
else
your_column
end
from your_table;只需注意电话号码字符串中的前导空格或其他字符。
https://stackoverflow.com/questions/13153170
复制相似问题