7 Replies Latest reply: Feb 20, 2013 12:21 AM by 979801 RSS

    Exception Handaling problem

    979801
      Hello,
      I am new in Oracle forms.There is in Java or c#,a try catch block is available to trap any type of exception( occurred in code ) even we do not know the name of exception/error or code of exception.
      I want know how we can do the following event in oracle forms as in c# or Java code given below,


      int i,j,k;
      try
      {
      i= text_Box1.text; // here text_Box1 is a text item and in this suppose we have entered value 120.
      j=text_Box12.text; // here text_Box2 is another text item and in this we entered value=0.
      k= i / j; //divide here i and j's values
      }
      catch
      {
      messagebox.show("An Exception is occurred,Please Give Proper input "); // to just show a message when any exception is occurred in code in the try block.
      }


      here when we have value in k is infinite then an exception is raised but here neither we need to give any name-identification of exception nor any conditional statement of raising exception in code.
      please help me how can i do above working in oracle forms using pl/sql.
      Thank You
        • 1. Re: Exception Handaling problem
          HamidHelal
          Hi,

          Check this link
          Handling PL/SQL Errors


          Hope this helps


          Hamid


          Mark correct/helpful to help others to get right answer(s).*
          • 2. Re: Exception Handaling problem
            979801
            I know how to do this in pl/sql traditionally .For this firstly i have to write a conditional statement on which a specified exception is occurred.
            like

            declare
            e exception ;
            begin
            if -- conditional statement for which i have to raise exception when found then raise it.
            end if
            exception
            end;


            to do this i have to sure that what type of exception is possible.But in that case in which we dont make possibilities then how to handle these type of exceptions
            • 3. Re: Exception Handaling problem
              HamidHelal
              976798 wrote:
              I know how to do this in pl/sql traditionally .For this firstly i have to write a conditional statement on which a specified exception is occurred.
              like

              declare
              e exception ;
              begin
              if -- conditional statement for which i have to raise exception when found then raise it.
              end if
              exception
              end;


              to do this i have to sure that what type of exception is possible.But in that case in which we dont make possibilities then how to handle these type of exceptions
              In general you will know, what type of error occur in your code. If you can't define, you can write custom (you own) exception, thats will help you where the problem occurred.
              For example
              .....your code
              raise_application_error(-20000,'Failed to send mail due to Approve band data not found. ' || sqlerrm);
              Hope this helps...
              • 4. Re: Exception Handaling problem
                979801
                Thanks for reply,
                1) For a case in which you have no knowledge about upcoming error and raising conditional statement then how to handle errors.
                2) Suppose there may occur few exceptions(more than 1) in code and you have to handle those then it is necessary to raise and handle exception at each item level validation.
                • 5. Re: Exception Handaling problem
                  Andreas Weiden
                  For a case in which you have no knowledge about upcoming error and raising conditional statement then how to handle errors.
                  The best way is to not handle them at all, but let them raise. So you get at least as much information as possible.
                  Suppose there may occur few exceptions(more than 1) in code and you have to handle those then it is necessary to raise and handle exception at each item level validation.
                  What exactly is the question?
                  • 6. Re: Exception Handaling problem
                    979801
                    Problem Algorithm is Given in a JPEG format pls give me a solution for that
                    thank you please go through
                    [http://www.club-oracle.com/forums/how-to-handle-exception-in-oracle-forms-using-pl-sql-t7909/]
                    • 7. Re: Exception Handaling problem
                      979801
                      Thanks