PL/SQL (MOSC)

MOSC Banner

correct error line number in exception handling

edited Nov 30, 2009 11:13PM in PL/SQL (MOSC) 8 commentsAnswered
hallo,
if i do something like this:

    SQL> create or replace function test ( txt in varchar2 ) return varchar2 is
      2          n number;
      3  begin
      4          n := to_number(txt);
      5          return 'ok';
      6  exception when others then
      7          raise_application_error(-20100, sqlerrm, true);
      8  end;
      9  /

    Funktion wurde erstellt.

    SQL>
    SQL> select test ('5') from dual;

    TEST('5')
    ------------------------------------------------------------
    ok

    SQL> select test ('x') from dual;
    select test ('x') from dual
           *
    FEHLER in Zeile 1:
    ORA-20100: ORA-06502: PL/SQL: numerischer oder Wertefehler: Fehler beim Konvertieren von Zeichen zu Zahl
    ORA-06512: in "USER.TEST", Zeile 7
    ORA-06502: PL/SQL: numerischer oder Wertefehler: Fehler beim Konvertieren von Zeichen zu Zahl

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center