说有两个字符串:
String 1:'group global Tissue'
String 2:'GLOBAL TISSUE GROUP INC'
计数应为3。因为全局,组织和组在这两个字符串之间是公用的。注意:匹配不区分大小写。
t1
CTE将第一个字符串分成几行t2
对第二个字符串所做的相同GLOBAL
和global
匹配)is not null
条件是SQL> with test (col1, col2) as
2 (select 'group global Tissue', 'GLOBAL TISSUE GROUP INC' from dual),
3 t1 as
4 (select lower(regexp_substr(col1, '[^ ]+', 1, level)) val1
5 from test
6 connect by level <= regexp_count(col1, ' ') + 1
7 ),
8 t2 as
9 (select lower(regexp_substr(col2, '[^ ]+', 1, level)) val2
10 from test
11 connect by level <= regexp_count(col2, ' ') + 1
12 )
13 select count(*)
14 from (select val1 from t1 where val1 is not null
15 intersect
16 select val2 from t2 where val2 is not null
17 );
COUNT(*)
----------
3
SQL>