【发布时间】:2020-02-21 15:30:18
【问题描述】:
我在下面得到了一些 sql 脚本来删除单词之间的单词,但它会找到我的 (/hide) 的最后一次出现而不是第一次出现。需要帮助才能按预期获得输出。谢谢。
select regexp_replace('(hide)it(/hide)should be show(hide)my(/hide) text',
'^\(hide\).*\(/hide\)', '') "TESTING"
from dual;
我希望输出是:
should be show text
但实际输出是:
text
如果我的数据位于数据类型为 clob 的列之一中。目前我使用下面的脚本来选择。例如,我的表是 testing_table,其列 desc_str 和 data_type 为 clob,其中包含值 '(hide)it(/hide)should be show(hide)my(/hide) text';
select trim(to_char(regexp_replace(desc_str,'^\(hide\).*\(/hide\)',''))) as desc
from testing_table
where OOE_FP_SS_ID = $id;
【问题讨论】:
-
我使用的是oracle sql developer。
标签: sql regex oracle regexp-replace