Sql Only 字符串搜索

标签 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]%'

为什么我无法在输出中获得所有 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/

相关文章:

shell - KSH 检查字符串是否以子字符串开头

oracle - pl/sql中数字的阶乘

mysql - Datediff 语句中的用例

sql - 引用复合主键

c - 在 C 中查找字符串中的子字符串

python - 将字符串转换为具有正确类型的字典变量

sql - 数据库:流水线函数

sql - 在 Oracle 中添加小数点和零

SQL Server 存储过程 - If Count() 语句

mysql - 计费触发器的数据库设计