仅限Sql字符串搜索

May*_*wal 5 sql string oracle oracle11g

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]%'
Run Code Online (Sandbox Code Playgroud)

为什么我无法获得输出中的所有3条记录,我使用的是Oracle SQL Developer 11g

我使用此查询的原因是:我想检查Desired列是否仅包含字符串无数字和特殊字符

Luk*_*zda 5

您正在混合使用SQL Server和Oracle语法:

SQL SERVER演示:

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
Run Code Online (Sandbox Code Playgroud)

ORACLE演示:

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]')
Run Code Online (Sandbox Code Playgroud)