首页 > 解决方案 > 如何使用正则表达式在 Oracle 中提取括号外的单词?

问题描述

我想从列中提取括号外的值。

询问:

select dwn_notes from down_time;

查询结果:

4 hour scheduled downtime (dball, 01/04/2019 09:14)
4 hour scheduled downtime (dball, 01/04/2019 09:14)
4 hour scheduled downtime (dball, 01/04/2019 09:14)
4 hour scheduled downtime (dball, 01/04/2019 09:14)

标签: sqlregexoracle

解决方案


这将起作用:

select regexp_replace(down_notes,'[(]{1}(.)*[)]{1}','') from Table1;

检查小提琴:http ://sqlfiddle.com/#!4/b52fd/6


推荐阅读