你好,我有以下 PL\SQL 块
DECLARE
v_clob CLOB := 'This is a sample SQL query /* APPEND PARALLEL(table) hint */ with a hint. /* PARALLEL(table) hint */';
v_new_clob CLOB;
BEGIN
-- Replace the comment containing 'APPEND PARALLEL' with an empty string
v_new_clob := REGEXP_REPLACE(v_clob, '/\*.*?APPEND\s+PARALLEL.*?\*/',null); /* '', 1, 0, 'i'*/
-- Output the modified CLOB
DBMS_OUTPUT.PUT_LINE(v_new_clob);
END;
其结果是:
This is a sample SQL query with a hint. /* PARALLEL(table) hint */
上述模式的目的是捕获动态 SQL 查询中包含 APPEND 的并行提示。
我想为 REGEXP_REPLACE 创建一个模式,以捕获并行提示并确保不包含 APPEND。因此,我需要的上述 CLOB 结果是:
This is a sample SQL query /* APPEND PARALLEL(table) hint */ with a hint.
提前致谢!