通配符,用于排除字符前后的所有数字

问题描述 投票:0回答:2

我想找到VIA BOEZIO 6之类的所有地址。我用过:

select address
from tab
where address like '%VIA%BOEZIO%6%'

但是不幸的是,这是结果:

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS82RVk5ZC5wbmcifQ==” alt =“在此处输入图像描述”>

是否有一种方法可以排除“ 8”之前和之后的所有数字字符。您能帮我吗?

谢谢Mattia

sql oracle sql-like numeric exclude
2个回答
0
投票

考虑:

SELECT address
FROM tab
WHERE address LIKE '%VIA%BOEZIO_6%';

这使用_仅接受BOEZIO和数字6之间的单个字符。这只会匹配:

VIA BOEZIO 6
VIA BOEZIO 6A

0
投票

我怀疑您想要regexp_like()

select address
from tab
where regexp_like(address, 'VIA BOEZIO[^0-9]*6')
© www.soinside.com 2019 - 2024. All rights reserved.