对pl/sql中的字符串进行标记并获取唯一标记?

ken*_*eer 2 sql oracle plsql token tokenize

我要求在pl/sql中对字符串进行标记,并仅返回唯一的标记.我已经看到了将字符串标记化的示例,但没有一个会返回唯一的标记.

例如查询 -

select tokenize('hi you person person', ' ') as col1 from dual;
Run Code Online (Sandbox Code Playgroud)

应该回来 TOKEN_LIST('hi','you','person')

代替 TOKEN_LIST('hi','you','person','person')

PM *_*7-1 6

with t as (select 'aaaa bbbb cccc dddd eeee ffff aaaa' as txt from dual)
-- end of sample data
select DISTINCT REGEXP_SUBSTR (txt, '[^[:space:]]+', 1, level) as word
from t
connect by level <= length(regexp_replace(txt,'[^[:space:]]+'))+1;
Run Code Online (Sandbox Code Playgroud)

上面的脚本产生以下结果:

WORD
dddd
eeee
bbbb
ffff
cccc
aaaa
Run Code Online (Sandbox Code Playgroud)

这个想法是从OTN社区的答案中无耻地窃取的.

SQL小提琴