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

解决方案 »

  1.   

    你的写法我看过了,但在declare 中,我在游标中能用你这个函数吗??用例外不是隐式的关闭了游标吗?是不是这样啊
      

  2.   

    create or replace procedure a is
      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 中,我在游标中能用你这个函数吗??
    =============================
    可以用例外不是隐式的关闭了游标吗?
    =========================
    没有,异常被捕获了
      

  3.   

    楼主可以到这里来下载csdn论坛oracle杂志创刊号,里面有一篇文章可以参考.http://www.csdn.net/EMagSub/download/CSDN_Emag_Oracle.rar