如何查询字段中不包含字母的值

coolzdp 2010-11-11 12:40:49
有些记录如下
ABC32443
3424/334
33444

现在想只取出不含字母的记录如
3424/334
33444

该如何写select ?
...全文
1170 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
心中的彩虹 2010-11-11
  • 打赏
  • 举报
回复

SQL> with tb as
2 (select 'ABC32443' bm from dual union all
3 select '3424/334' from dual union all
4 select '33444' from dual )
5 select bm from tb where not regexp_like(bm,'[[:alpha:]]')
6 /

BM
--------
3424/334
33444





[Quote=引用楼主 coolzdp 的回复:]
有些记录如下
ABC32443
3424/334
33444

现在想只取出不含字母的记录如
3424/334
33444

该如何写select ?
[/Quote]




minitoy 2010-11-11
  • 打赏
  • 举报
回复
SQL> select 1 from dual where not regexp_like('32443','[a-z]','i');

1
----------
1

SQL> select 1 from dual where not regexp_like('32443a','[a-z]','i');

1
----------

SQL>
ngx20080110 2010-11-11
  • 打赏
  • 举报
回复

with tmp as
(
select 'ABC32443' col1 from dual union all
select '3424/334' col1 from dual union all
select '33444' col1 from dual)
select * from tmp
where not regexp_like(col1, '[a-z]','i');

COL1
------------
3424/334
33444
ngx20080110 2010-11-11
  • 打赏
  • 举报
回复
select * from table1 where not regexp_like(col1, '[a-zA-Z]');
gelyon 2010-11-11
  • 打赏
  • 举报
回复

select * from table_name where not regexp_like(col_name,'[[:alpha:]]')

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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