怎样SqL语句来检索出某列中包含电话号码的数据?谢谢

arlgil1 2013-08-08 05:55:41
比如某表中有列cont:
id cont
1 tel:13933392233
2 asdf;kj
3 x:010-38392231
4 I have a wach
5 I can give you my number:18922363298.and you?
6 your number is 021 3821234234?
7 how are you?
8 and and ... ..hah ha
9 your phone is (86)891-2828228?ok?
10 your dianing room number is 211 or 232?

通过什么语句,能够把cont中涉及电话号码的数据检索出来呢??

即检索结果为:
1 tel:13933392233
3 x:010-38392231
5 I can give you my number:18922363298.and you?
6 your number is 021 3821234234?
9 your phone is (86)891-2828228?ok?
...全文
494 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
arlgil1 2013-08-09
  • 打赏
  • 举报
回复
实在没有看懂哦,能稍微解释一下嘛??谢谢啦。 另外能编写成一个过程的吗?
forgetsam 2013-08-08
  • 打赏
  • 举报
回复
where regexp_like(cont,'正则表达式')
  • 打赏
  • 举报
回复
大致的正则过滤 如果要具体的 可以网上搜索 电话正则 很多的 需求不同 写法也不同

with t1 as
(
select 1 id,'tel:13889233453' cont from dual union all
select 2 id,'x:010-38392231' from dual union all
select 3 id,'I have a wach' from dual union all
select 4 id,'ph:010-33884499' from dual union all
select 5 id,'your number is 021-3821234234?' from dual
)

select id,cont
from t1
where regexp_like(cont,'(\d{3}-)?\d{8}|(\d{4}-)(\d{7})')  
      or regexp_like(cont,'^1[3|4|5|8][0-9]\d{8}$')

    id        cont
----------------------------------------
1	1	tel:13889233453
2	2	x:010-38392231
3	4	ph:010-33884499
4	5	your number is 021-3821234234?
arlgil1 2013-08-08
  • 打赏
  • 举报
回复
能具体写一个示例语句吗?

17,140

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧