oracle pl sql error oracle pl sql error oracle pl sql error
 

Oracle/PLSQL: SQLCODE Function


What does the SQLCODE Function do?

The SQLCODE function returns the error number associated with the most recently raised error exception. This function should only be used within the Exception Handling section of your code:

EXCEPTION     WHEN exception_name1 THEN         [statements]

    WHEN exception_name2 THEN         [statements]

    WHEN exception_name_n THEN         [statements]

    WHEN OTHERS THEN         [statements]

END [procedure_name];

You could use the SQLCODE function to raise an error as follows:

EXCEPTION    WHEN OTHERS THEN       raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM); END;

Or you could log the error to a table as follows:

EXCEPTION    WHEN OTHERS THEN       err_code := SQLCODE;       err_msg := substr(SQLERRM, 1, 200);

      INSERT INTO audit_table (error_number, error_message)       VALUES (err_code, err_msg); END;

Learn more about the SQLERRM Function.

 

 
 
 
 
Oracle news Oracle guide
     
  29-11-2006 Guida Oracle 10g
     
  30-02-2007 Oracle Server
     
  29-02-2007 Oracle Errors ORA-00018
Functions Oracle Functions
Delete Delete
Between Between
Check Check
Count Count
Datatypes Datatypes
Delete Oracle Delete Statement
Distinct Distinct
Exists Exists
Functions Functions
Grant revoke Grant Revoke
Group by Oracle Group by
Having Having
Oracle Function in Oracle Function in
Indexes Indexes
Insert Insert
Intersect Intersect
Isnull Is null
Joins Joins
Substr Substr
instr Oracle instr
blob Oracle blob
roles Oracle roles
Substr Substr
like Oracle like
Substr Oracle minus
Substr Oracle to_number
union Oracle union
query Oracle query
Substr Oracle unique
Substr Oracle union all
Substr Oracle alter table
 
Oracle Functions PLSQL  l Consulenza Software Verona  l  Siti Web Verona  l   Exceptions  l  Oracle Errors   l  Oracle Collaborations Suite  l  Products  l  Contact
Oracle errors ora