with temp(name) as (select 'abc' from dual
union select '123abc' from dual
union select '1abc3' from dual)
select * from temp where temp.name like '%[a-z]%'
为什么我无法在输出中获得所有 3 条记录
,我使用的是 Oracle SQL Developer 11g
我使用此查询的原因是:我想检查 Desired 列是否只包含字符串,没有数字和特殊字符
最佳答案
您正在混合 SQL Server 和 Oracle 语法:
SQL SERVER Demo :
with temp(name) as (
select 'abc' union all select '123abc' union select '1abc3'
)
select * from temp where temp.name like '%[a-z]%';
-- [] is T-SQL specific
ORACLE Demo :
with temp(name) as (select 'abc' from dual
union select '123abc' from dual
union select '1abc3' from dual)
select * from temp where regexp_like(temp.name, '[a-z]')
关于Sql Only 字符串搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50699812/