oracle - 查询多值列
问题描述
我有一个多值列 MISC_CONTENT,列中有以下字符串:
amount = 7995 ;channel = SXXXN21 ;group_header = NPS099 ;currency = EUR
如何通过 group_header 查找来检索值 NPS099?
解决方案
我们可以尝试使用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;
推荐阅读
- linux - 如何在 NGINX 上从 https 卸载到 http?
- python - 在 IIS 生产服务器上使用最新版本 celery 的最佳方法
- cinema-4d - 在 C4D 中从 Solidworks/Rhino 展开模型
- ubuntu - 如果 VNC 服务器连接失败,活动进程会继续运行吗?
- mysql - 基于 DB 值返回的限制结果
- testing - TestCafe:如何在基本 url 中传递授权令牌
- oracle - 我们如何在oracle中将多行数据作为单行获取
- nginx - 如何为同一域上的多个站点配置 Nginx?
- vuex - 在 CompositionAPI 的设置方法中过滤时为空 .value
- ubuntu - 如何将 GHCI(命令和命令结果)输出到 bash 和文本文件?