SQL> with station (city) as
2 (select 'Zagreb' from dual union all
3 select 'Athens' from dual union all
4 select 'Rome' from dual union all
5 select 'Ottawa' from dual
6 )
7 select distinct city
8 from station
9 where upper(substr(city, 1, 1)) not in ('A', 'E', 'I', 'O', 'U')
10 and upper(substr(city, -1)) not in ('A', 'E', 'I', 'O', 'U');
CITY
------
Zagreb
SQL>
如果必须使用regex,则
7 select distinct city
8 from station
9 where regexp_like(city, '^[^aeiou].*[^aeiou]$', 'i');
CITY
------
Zagreb
SQL>
1条答案
按热度按时间xtupzzrd1#
它必须是regex吗?
substr
以简单的方式处理它:如果必须使用regex,则