create or replace function isdigit(str varchar2) return number is
i number;
begin
i:=str;
return i;
exception
when others then
return null;
end;SQL> select decode(isdigit('a22'),null,'not digit','digit') from dual;DECODE(ISDIGIT('A22'),NULL,'NO
------------------------------
not digitSQL> select decode(isdigit('22'),null,'not digit','digit') from dual;DECODE(ISDIGIT('22'),NULL,'NOT
------------------------------
digitSQ
i number;
begin
i:=str;
return i;
exception
when others then
return null;
end;SQL> select decode(isdigit('a22'),null,'not digit','digit') from dual;DECODE(ISDIGIT('A22'),NULL,'NO
------------------------------
not digitSQL> select decode(isdigit('22'),null,'not digit','digit') from dual;DECODE(ISDIGIT('22'),NULL,'NOT
------------------------------
digitSQ
i pls_integer:=0;
cursor c1 is select isdigit(COMMISSION_PCT) result from emp;
begin
for rec in c1 loop
if not rec.result is null then
i:=i+1;
end if;
end loop;
dbms_output.put_line(i);
end;
在declare 中,我在游标中能用你这个函数吗??
=============================
可以用例外不是隐式的关闭了游标吗?
=========================
没有,异常被捕获了