这个可以直接在plsql里面运行,应该是你要的东西,记得给分哦
declare
str varchar2(100) :='val((3+4)/7)+val(4+5)+10';
substr varchar2(100):='';
valuestr varchar2(100):='';
strsql varchar2(100):='select exp from dual';
exesql varchar2(100):='';
begin
while(regexp_instr(str,'\(\d+([+-\*/]\d+)*\)')>0)
loop
substr:=regexp_substr(str,'\(\d+([+-\*/]\d+)*\)');
exesql:=replace(strsql,'exp',substr);
execute immediate exesql into valuestr;
str:=replace(str,substr,valuestr);
end loop;
str:=replace(str,'val','');
dbms_output.put_line(str);
end;