我正在研究SQL Developer。我只想要那些有非数字数据的记录。我使用的查询是:
select * from TBL_NAME where regexp_like (mapping_name,'%[!0-9]%');
奇怪的是,这不起作用。
答案 0 :(得分:1)
这个怎么样?如你所说,返回非数字的值。
SQL> with test (col) as
2 (select 'abc123' from dual union
3 select '12345' from dual union
4 select 'abc' from dual union
5 select '($ff3' from dual union
6 select '12.345' from dual
7 )
8 select col
9 from test
10 where not regexp_like (col, '^\d+|(\.\d+)$');
COL
------
($ff3
abc
abc123
SQL>
如果没有小数值,正则表达式甚至更简单:'^\d+$'
[编辑后,提供样本数据后]
一块蛋糕:
SQL> with test (col) as
2 (select 'ABC' from dual union
3 select 'BCE1' from dual union
4 select '2GHY' from dual union
5 select 'WE56S' from dual union
6 select 'TUY' from dual
7 )
8 select col
9 from test
10 where not regexp_like (col, '\d');
COL
-----
ABC
TUY
SQL>