查询多值列

时间:2019-11-04 03:31:22

标签: oracle lookup multivalue

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

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

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

1 个答案:

答案 0 :(得分:0)

我们可以尝试使用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,1,NULL,2)
FROM yourTable;