如果你的意思是对输入的一个字符串的表达式求值,可以用动态SQL实现。SQL> create or replace function fun1(inexp varchar2) return number
2 as
3 v number;
4 begin
5 execute immediate 'select '||inexp||' from dual' into v;
6 return v;
7 end;
8 /Function created.SQL> select fun1('2+3+4') from dual;FUN1('2+3+4')
-------------
9
2 as
3 v number;
4 begin
5 execute immediate 'select '||inexp||' from dual' into v;
6 return v;
7 end;
8 /Function created.SQL> select fun1('2+3+4') from dual;FUN1('2+3+4')
-------------
9
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货