1

I'm writing a C# application that executes some functions stored in packages in oracle database. Unfortunately, I don't have access and I can not change the structure of these functions...

The functions are made such that, when the operation went good, they return 0, otherwise they return the oracle error code number.

Of course if I search for these codes (ORA-xxxxx) in the internet I can know what went wrong but I would like to display, in case of an error, a message to the user to understand the error instead of just showing the error number.

Does anyone know to get the oracle error message associated with the error number ?

Thank you in advance.

1 Answer 1

3
CREATE OR REPLACE FUNCTION get_error_msg(f_code IN NUMBER) RETURN VARCHAR2
AS
BEGIN
   RETURN sqlerrm(-f_code); 
END;

select get_error_msg(100) from dual;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.