查询多值列

我有一个多值列MISC_CONTENT,该列中包含以下字符串:

amount = 7995 ;channel = SXXXN21 ;group_header = NPS099 ;currency = EUR

如何通过使用group_header进行查找来检索值NPS099?

mubai1990 回答:查询多值列

我们可以尝试使用REGEXP_SUBSTR

WITH yourTable AS (
    SELECT 'amount = 7995 ;channel = SXXXN21 ;group_header = NPS099 ;currency = EUR' AS col FROM dual
)

SELECT
    REGEXP_SUBSTR(col,'(^|\s|;)group_header = (.*?)\s*(;|$)',1,NULL,2)
FROM yourTable;
本文链接:https://www.f2er.com/3169231.html

大家都在问