oracle - 使用 sql 查询获取 clob 字段中的每一行
问题描述
我在由多行数据组成的表中有一个 clob 字段。我想从此字段中获取特定行。
数据是如下所示的字段:
Project xxxxxx.
Reschedule Details:
Current Planned End Date: xxxxx
Adjusted Planned End Date: xxxxx
Current Forecasted Date: xxxxx
Reason: xxxxx – xxxxx
Comments: xxxxx
我的要求是获取原因和评论行数据。
解决方案
REGEXP_SUBSTR
与多行选项一起使用,m
这意味着字符串中的换行符终止一行。因此,行首锚 ( ^
) 和行尾锚 ( $
) 可用于终止。
select regexp_substr(s,'Reason:\s*(.+)$' ,1,1,'m',1) as Reason,
regexp_substr(s,'Comments:\s*(.+)$',1,1,'m',1) as Comments
from t
推荐阅读
- python - Python,通过匹配键值的字典SUM列表
- visual-studio-2019 - 如何使用 Visual Studio 2019 创建 C# 版本 9.0 应用程序
- opencv - 如何为 OpenCV 中值模糊()(水平中值滤波器)指定自定义内核
- javascript - 如何确保网页元素在 selenium execute_script 调用后正确加载,然后再进行抓取
- c# - 选中 WPF 工具提示可见性绑定到 RadioButton
- html - 我如何制作它,以便我可以浏览整个表格?
- python - 用于大型应用程序的系统架构和堆栈
- javascript - 如何在 Ember.js 中存根任务?
- python - 使用子节点解析 xml 并创建 Pandas 数据框
- python - 通过 selenium 下载文件后无法更改目录