![](/img/trans.png)
[英]Append single quotes at starting and ending of the alphanumeric in Oracle
[英]Find strings starting with alphanumeric in Oracle
我只想搜索所有以字母或數字開頭的記錄。
我知道有 REGEXP_LIKE 可以查找 col 是否包含字母數字但不能將其應用於開頭。
SELECT * FROM mytable WHERE col1 like 'ABC:XYZ%'
我有以下格式的數據:-
ABC:XYZ
ABC:XYZ (ERW)
ABC:XYZ TMN
ABC:XYZ123
ABC:XYZRTY:YER
我試圖只低於 output
ABC:XYZ
ABC:XYZ123
ABC:XYZRTY:YER
問候
像這樣的東西? 采樣數據到第 #7 行; 您可能感興趣的查詢從第 8 行開始。
SQL> with mytable (col1) as
2 (select 'ABC:XYZ' from dual union all
3 select 'ABC:XYZ (ERW)' from dual union all
4 select 'ABC:XYZ TMN' from dual union all
5 select 'ABC:XYZ123' from dual union all
6 select 'ABC:XZYRTY:YER' from dual
7 )
8 select col1
9 from mytable
10 where not regexp_like(col1, '[^[:alnum:]:]');
COL1
--------------
ABC:XYZ
ABC:XYZ123
ABC:XZYRTY:YER
SQL>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.