有以下声明:
WITH tokenkeys
as
(
select regexp_substr('A set of words from other side','[^ ]+', 1, level) WORDSPLIT from dual
connect by regexp_substr('A set of words from other side', '[^ ]+', 1, level) is not null
)
select * from tokenkeys
输出如下表格:
|WORDSPLIT|
|A |
|set |
|of |
|words |
|from |
|other |
|side |
我想在where / in语句中使用这个临时集合:
WITH tokenkeys
as
(
select regexp_substr('A set of words from other side','[^ ]+', 1, level) WORDSPLIT from dual
connect by regexp_substr('A set of words from other side', '[^ ]+', 1, level) is not null
)
select p.* from people p
where
p.name in (tokenkeys.wordsplit)
or UTL_MATCH.EDIT_DISTANCE_SIMILARITY(p.lastname, tokenkeys.wordsplit) > 60 ???
or ....
我有两个问题:
p.name in (tokenkeys.wordsplit)
?示例:
UTL_MATCH.EDIT_DISTANCE_SIMILARITY(p.lastname, tokenkeys.wordsplit) > 60
//I want the greater
max(UTL_MATCH.EDIT_DISTANCE_SIMILARITY(p.lastname, tokenkeys.wordsplit))
//I can't yet test this line.
非常感谢。
答案 0 :(得分:0)
将join
与distinct
一起使用(将where子句转移到连接条件 - on
):
WITH tokenkeys
as
(
select regexp_substr('A set of words from other side','[^ ]+', 1, level) WORDSPLIT from dual
connect by regexp_substr('A set of words from other side', '[^ ]+', 1, level) is not null
)
select distinct p.* from people p
join tokenkeys on p.name in (tokenkeys.wordsplit)
or UTL_MATCH.EDIT_DISTANCE_SIMILARITY(p.lastname, tokenkeys.wordsplit) > 60