17,088
社区成员
发帖
与我相关
我的任务
分享
CREATE OR REPLACE FUNCTION REPLACE_KUOHAO(STR IN VARCHAR2)
RETURN VARCHAR2
IS
TEMPSTR VARCHAR2(4000) := STR;
BEGIN
WHILE INSTR(TEMPSTR,'(') > 0 AND INSTR(TEMPSTR,')') > 0 LOOP
SELECT REGEXP_REPLACE(TEMPSTR,'\([^\(\)]*\)') INTO TEMPSTR FROM DUAL;
END LOOP;
RETURN TEMPSTR;
END;
select REPLACE_KUOHAO('(start)123()45(ab(d(t)ef)c)6789(end)') from dual
select REGEXP_REPLACE('12345(asdasda)6789','\(.*\)') from dual
create or replace function func_replace_kuohao_zhengze
(
busiscope in varchar2
)
return varchar2
is
tempbusiscope varchar2(4000) := busiscope;
begin
Dbms_Output.Put_Line('执行完begin:');
while instr(tempbusiscope,'(') > 0 and instr(tempbusiscope,')') >0
loop
Dbms_Output.Put_Line('进入loop:');
select regexp_replace(tempbusiscope,'\([^()]*\)') into tempbusiscope from dual;
end loop;
return tempbusiscope;
end;
select func_replace_kuohao_zhengze('销售:化工产品(不含危险化学品及一类易制毒化学品)、机械设备、日用百货、针纺织品、电线电缆、五金交电、建筑材料;化工产品的技术研发(不含危险化学品及一类易制毒化学品)。经营其它无需行政审批即可经营的一般经营项目。(依法须经批准的项目,经相关部门批准后方可开展经营活动)。') from dual