to_number(vstring) < b and to_number(vstring) >a

解决方案 »

  1.   

    1  create or replace procedure pro_test
      2  ( a number,
      3    b number,
      4    vstring varchar2
      5  )
      6  as
      7  begin
      8    if to_number(vstring)<a or to_number(vstring) > b then
      9       RAISE_APPLICATION_ERROR(-20007,'VSTRING 的值超出范圍');
     10    end if;
     11* end ;
    SQL> /程序已被建立SQL> exec  pro_test(1,100,'120');
    BEGIN pro_test(1,100,'120'); END;*
     ERROR 在行 1:
    ORA-20007: VSTRING 的值超出范圍
    ORA-06512: at "SYSADM.PRO_TEST", line 9
    ORA-06512: at line 1