Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6362313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:53:32+00:00 2026-05-24T23:53:32+00:00

I have a try block in my C# client which executes an Oracle PL/SQL

  • 0

I have a try block in my C# client which executes an Oracle PL/SQL stored procedure and a catch block using Exception class.

In the stored procedure, if a particular condition is encountered during data processing, an exception is raised using raise_application_error.

Example: raise_application_error(-20001, myErrMsg)

I then want to catch this exception and show this particular message in the C# client as it is.

And for all the other database related errors (e.g. constraint failure, connection errors) I want to catch and them show in my custom error message in the C# client.

In my catch block, should I search for the string ORA-20001 in the exception message string and then propagate it to the client as it is to determine if the above exception is being thrown from the procedure?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T23:53:33+00:00Added an answer on May 24, 2026 at 11:53 pm

    Catch an Oracle Exception if you can.

      try
        {
          cmd.CommandText = "DELETE FROM myable";
          cmd.ExecuteNonQuery();
        }
        catch (OracleException ex)
        {
           //Put your ORA-20001 logic here, or call a common method as shown
           HandleOracleException(ex);
        }
    

    In the catch handler, check to see if the number is 20001, and then take appropriate action.

    Here are some properties of OracleException

    DataSource
    Specifies the TNS name that contains the information for connecting to an Oracle instance

    Errors
    Specifies a collection of one or more OracleError objects that contain information about
    exceptions generated by the Oracle database

    InnerException
    Inherited from Exception

    Message
    Specifies the error messages that occur in the exception

    Number
    Specifies the Oracle error number

    Procedure
    Specifies the stored procedure that cause the exception

    Source
    Specifies the name of the data provider that generates the error

    StackTrace
    Inherited from Exception

    TargetSite
    Inherited from Exception

    Link For More Info:

    http://download.oracle.com/docs/cd/B19306_01/win.102/b14307/OracleExceptionClass.htm

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple try/catch block try { // Open the connection _connection.Open(); //
I have a stored procedure, PROC , which receives some parameters. If one of
so in my program I have parts where I use try catch blocks like
I have a fun issue where during application shutdown, try / catch blocks are
We have following code: try { // some code throwing MyException } catch (MyException
I have some 3-4 stored procedures ― which I can modify if needed ―
I have the following code. I enclosed it in a try block and try
I'm using agsXMPP in my .NET project (WinForms) I have the following Code block,
all. I have the following region I keep snippetting after the try {} blocks.
i have try refox and see how eazy my EXE to be disassembled. the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.