Possible to catch parameters exceptions in the program ?

Hi,
Oracle 10g r2.
I have some procedures/functions like :
function insert_op (op_name in varchar2, op_date in date, op_length in number) is
begin
end;If I call for example :
insert_op('test','02/05/2010','hehe')I will get an error (invalid number). Normal.
My qyestion is, is it possible to catch that exception in the function ?
The fact is that my function is called from an input button in my apex application, so if user enter wrong values in the form, I can't catch the error except using Javascript.
Or should I pass all my parameters as varchar2, and then make functions to ckeck if it is valid numbers, dates, etc... :/
Thanks.
Yann.

function insert_op(op_length in number) return varchar2 is
temp number;
begin
temp := TO_NUMBER(op_length);
return 'ok it is a number';
exception
when others then return 'not a number';
end;Define the op_length as varchar2
create or replace function insert_op(op_length in varchar2) return varchar2 is
temp number;
begin
   temp := TO_NUMBER(op_length);
   return 'ok it is a number';
exception
when others then return 'not a number';
end;And further most important thing is dont use WHEN OTHERS. Use the specific exception. In this case VALUE_ERROR.
I have done such thing in the past. Here is that code.
create or replace function is_number(pVal in varchar2) return number
as
   lNum number;
begin
   lNum := to_number(pVal);
   return 1;
exception
   when value_error then
           return 0;
end;Edited by: Karthick_Arp on Mar 1, 2011 5:26 AM

Similar Messages

  • Is it possible to just install one of the programs in the suite separately?

    I am considering buying Creative Suite CS3.3. I need the new Flash for a project I'm working on now. I'd like to wait to upgrade my current versions of InDesign and Dreamweaver for a few weeks because I don't want to deal with any upgrade issues that I don't have to right away.
    Anyone know if I can install Flash first and then go back and install the rest?
    Thanks.

    Yes, but notice that CS3.3 does not have any newer versions of InDesign or Dreamweaver. It's basically all the standard CS3 Design Premium applications with Acrobat 9 and Fireworks CS3 bundeld with them.
    It seems many people are making this mistake... or maybe I misunderstood and you have a version prior to CS3 at the moment.

  • Synchronization stops and no reason given except saying the program has stopped unexpectedly.

    Synchronization stops unexpectedly.  Despite a recent update from Verizon the error message says, "BB Desktop Manager has stopped working. Operation terminated unexpectedly while processing Calendar during synchronization."  Note, this also happened before the Verizon update, so there should be no blame on Verizon.  Are there any suggestions?  Thanks, 

    Hi,
    I would clear the calendar database on the device and do a one way sync from outlook to the device
    to repopulate the calendar. It appears you have a corrupt record in the calendar on the device.
    Thanks,
    Bifocals
    Please remember to resolve your thread.
    Put the check mark in the green box that contained your answer! Thanks   
    Use method One
    http://www.blackberry.com/btsc/search.do?cmd=displayKC&docType=kc&externalId=KB04950&sliceId=SAL_Pub...
    Click Accept as Solution for posts that have solved your issue(s)!
    Be sure to click Like! for those who have helped you.
    Install BlackBerry Protect it's a free application designed to help find your lost BlackBerry smartphone, and keep the information on it secure.

  • Catching an exception thrown from another thread

    I have a SocketServer that creates new threads to handle incoming clients. If one of the threads throw a SQLException is it possible to catch that exception in the SocketServer that created that thread.
    I tried implementing this code and I cannot get the server to catch an exception thrown in the thread. Are my assumptions correct?
    I was reading something about Thread Groups and implementing an uncoughtException() method, but this looked like overkill.
    Thanks for your time!
    Some Example code would be the following where the ClientThread will do a database query which could cause an SQLException. I'd like to catch that exception in my Socket Server
          try
                 new ClientThread( socketServer.accept() , host, connection ).start();
          catch( SQLException e )
                 System.out.println( "DataSource Connection Problem" );
                  e.printStackTrace();
          }

    hehe, why?
    The server's job is to listen for an incoming message from a client and pass it off to a thread to handle the client. Otherwise the server will have to block on that incoming port untill it has finished handling the client and usually there are many incoming clients continuously.
    The reason I would want to catch an exception in the server based on the SQLException thrown in the thread is because the SQLException is usually going to be due to the fact the datasource connection has become unavalable, or needs to be refreshed. This datasource connection is a private variable stored in the socket server. The SocketServer now needs to know that it has to refresh that datasource connection. I would normally try to use somesort of flag to set the variable but to throw another wrench into my dilemma, the SocketServer is actually its own thread. So I can't make any of these variables static, which means I can't have the thread call a method on teh socket server to change the status flag. :)
    I guess I need implement some sort of Listener that the thread can notify when a datasource connection goes down?
    Thanks for the help so far, I figured java would not want one thread to catch another thread's exceptions, but I just wanted to make sure.

  • How to catch Exception inside the native code

    Hello,
    I have an error of unexpected exception during running native code,it occurrs randomly, not every time.
    the error text is:
    An unexpected exception has been detected in native code outside the VM.
    Unexpected Signal : 11 occurred at PC=0x9535F359
    Function=acy_match+0xC6
    Library=/usr/lib/libNegativeMatcher.so
    I don't know what exactly cause the crash inside the c code but I think it might be memory leak . What I'm concern is that this exception cause program termination.
    I have few questions:
    1. This exception cause the java program to end. How can I catch this exception and avoid program termination?
    2. What is 0xC6 in:
    Function=acy_match+0xC6
    and PC=0x9535F359?
    Can it help me track the problem inside the native code?
    Thanks for your help.

    An unexpected exception has been detected in native
    code outside the VM.
    Unexpected Signal : 11 occurred at PC=0x9535F359
    Function=acy_match+0xC6
    Library=/usr/lib/libNegativeMatcher.so
    I don't know what exactly cause the crash inside the
    c code but I think it might be memory leak . What
    I'm concern is that this exception cause program
    termination.I doubt it is a memory leak (actually I am rather certain that another error would occur if it was just memory exhaustion.)
    I have few questions:
    1. This exception cause the java program to end. How
    can I catch this exception and avoid program
    termination?I suspect that would be a really bad idea. That particular signal very likely indicates that you have corrupted memory. Continuing is unlikely to work.
    2. What is 0xC6 in:
    As a guess it is an offset into the compiled code which indicates where the memory problem was detected.
    That it unlikely to help you with a pointer/memory problem because that is where it was detected and not where it happened. By comparing the source you might be able to determine what was bad and then trace it back.

  • 11 Release 2 Activex viewer prompts for parameters even after I set them in the program

    My program worked in 11 base.  I upgraded to 11 Release 2 and now the viewer prompts the user for the parameters even though the program has set the parameters
    here's some of the code
    Dim aCRreport As CRAXDRT.Report
    Dim crystalParms As CRAXDRT.ParameterFieldDefinitions
    Dim crystalParm As CRAXDRT.ParameterFieldDefinition
    Set aCRreport = m_CRapp.OpenReport("c:\somereport.rpt")
    Set crystalParms = aCRreport.ParameterFields
    Set crystalParm = crystalParms(1)
    crystalParm.SetCurrentValue FormatDateTime(Now, vbShortDate), crStringField
    frmViewer.CRViewer1.ReportSource = aCRreport
    frmViewer.CRViewer1.ViewReport
    the viewer opens and asks for a value for parameter one. 
    Thanks, in advance, for any help

    I got the same problem. I could encounter it does appear when using date parameters. We are using german OS and german VS6 so date is localized as "dd.mm.yyyy" but in the report parameter fields it is expected as "jjjj-mm-dd". I cant convert the param in code because it will always be localized to german date.
    Could this be the problem? When yes why isn't crystal reports accepting localized dates?

  • Centralized way of catching unexpected Exceptions in Java?

    Hi Guys,
    Is there a centralized way to catch unexpected Exceptions in Java?
    Here's an example:
    public static void main(String[] args)
        try
          new Thread()
         public void run()
           String s = null;
              //NullPointerException is thrown here
           s.indexOf(12);
          }.start();
        catch (Exception ex)
          System.err.println("This is not called");
          ex.printStackTrace();
      }Think about a program error, that the program is not prepared for, i.e. NullPointerException or an ArrayIndexOutOfBounds exception.
    What I'm after is not like "put critical block in try-catch", but something like registering a global ExceptionListener in java.lang.Runtime, a monitoring MBean or something that I could use in my program to do a simple exception logging.
    Any idea, help would be greatly appreciated!
    peter

    NullPointerException , IOException ....all are subclasses of the base class Exception, so catch(Exception) will catch any exception in the current thread. So modify ur code a bit
    public static void main(String[] args)
          new Thread()
         public void run()
           try{
           String s = null;
              //NullPointerException is thrown here
           s.indexOf(12);
    catch (Exception ex)
          System.err.println("This is not called");
          ex.printStackTrace();
          }.start();
    .....

  • Catching event exceptions?

    Is it possible to catch event exceptions/errors? If yes, how? If no, why not?
    I get this error:
    Exception occurred during event dispatching: java.lang.Error: Destination component not connected to component tree hierarchy.
    Thanks in advance
    /Tommy

    The problem arises from a Tooltiptext of an object that is removed while the tooltiptext is visible. When I move the mouse pointer from the object (while the tooltiptext is still visible) during the object removal this error will occur.
    I guess I could write my own ToolTipText that handles these situation, but since the error doesn't affect the application more that printing out the error message and stack trace in the console, I though it could be caught instead.
    But I do not know where to put a try-catch clause to catch this error.
    /Tommy

  • Exiting the program

    Hi all,
    I catch all checked exceptions in my Java code. I want that my program terminates if an execption occurs (like an SQL exception). Is it safe to use System.exit(0) in the catch block to terminate the program? Is it safe and enough to stop the currently running Java Virtual Machine that way?
    The Java documentation syas: "...a nonzero status code indicates abnormal termination. "
    Does it mean I should use a nonzero code? Like: System.exit(1) or since it's my will to terminate the program, the zero code will do the job?
    Any help is greatly apprecited.

    It's fine if you want to use system.exit()
    The codes are just returned to the calling program, for example if you made a batch file to run your java program
    java myprogram
    if errorlevel == 1 @echo Your program bombed... HAHAHAHAHA...

  • Catching Converter Exceptions

    Hello! Anyone here have any idea or having the same problem on how to catch an exception from a DateTimeConverter object? It seems like a getAsObject() was performed before entering the validate action of a specific textfield which has a DateTimeConverter on it. I wanted to cutomize the message instead of the "Conversion error" that is appearing on my portlet.
    Thanks!!!

    Many Thanks Sakthi!!! how stupid of me!! I didn't see that it was on the tutorial hahaha been I've been looking for a reference for almost a day. anyway any idea also on how to catch an Exception form the validator when it is binded to a textfield? I've done it using a validator-method(event) but not when it is binded to a textfield is this possible?

  • PI - Proxy processing An exception with the type CX_SY_CONVERSION_NO_NUMBER

    Hi All,
    We have PI sync scenario,SOAP to Proxy.
    We are geeting the below error in Proxy .
    Error during proxy processing An exception with the type CX_SY_CONVERSION_NO_NUMBER occurred, but was neither handled locally, nor declared in a RAISING clause The argument ' 1,000.000' cannot be interpreted as a number.
    But when the same data got updated in Proxy.Not sure about the root cause of the error.
    Regards,
    Arun

    Hi ,
    It looks like proxy is not able to convert string to number or the format of number is incorrect. This is only possible reason of this exception.
    The argument ' 1,000.000' cannot be interpreted as a number.
    Check out if the format is correct.. .
    Regards
    Aashish Sinha

  • Exception handling in program

    Hi All,
         I have a class in one of the methos I'm raising an exception. When I'm calling that method in my program and when the exception is raised it is throwing a runtime error. The exception is no a system based exception it is an exception which is raised by me in the method only.
        Can anyone tell how to handle that exception in the program. My class name is zaccounts,
    the exception I'm raising is insufficient_fund.
    Many thanks!!!!

    Hi,
    Make sure you uncomment the exceptions part.
    if you still want to handle it further you can do that by using the RAISED exception
    Best Regards
    Ramchander Rao.K

  • How to prevent the program not to skip the process when exception is genera

    Hi, friends.
    How to prevent the program not to skip the process when exception is generated?
    For example, I am doing a process for 100 records. If the 15th record causes a Java Exception, I want to be able to skip it and continue processing the remaining 85 records.
    How it is possible with Java Exception handling? Any sample code?
    Thanks,
    Jaykishan

    [http://java.sun.com/docs/books/tutorial/essential/exceptions/]
    while (there are more lines) {
      try {
        process the next line
      catch (...) {
        log the error
    }[http://java.sun.com/docs/books/tutorial/essential/exceptions/]
    You'll want to be careful about which exceptions you catch though. For instance, if there's an unchecked exception, like NullPointerException, it's a sign of a bug in your code. Continuing to process as if that bug weren't there is often a worse approach than just failing. In this particular case, however, as long as you log the exception and then followup by fixing the bug that caused it, it may be acceptable to continue trying to process the rest of the file, even if some lines bring out a bug in your code.

  • How to get details about Exception catched in Exception branch of the Block

    Hello Experts,
    Is it possible to get details about Exception catched in Exception branch of the Block in Integration Process (BPM)?
    In the Exception branch System Error is catched, but from time to time different type of System Errors are happening during sync call to WebService - Connection Timeout, Connection Refused, UnknownHost, etc.
    So the task is somehow to map the type of System Error to the response. I was trying to create a mapping using as source the message which is coming from the Adapter after the sync call, but the mapping is failing with "No Source Payload" error.
    Maybe the description is somewhere in Header or Dynamic configuration?
    Or it is possible to access it somehow with JAVA-maping?
    Thanks for your help!

    Hey,
          the message from the exception can be utilized by using alerts(in order to mail,sms r fax). but otherwise its not possible using mappings or container.
    check this link for alert configuration.
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--step-by-step

  • Catch Mapping Errors on the Exception Hander in a BPM

    Hi All
    I am struggling to catch maping error in the Exception Handler, so my question is that, is it possible the catch mapping errors in the Exception Handler using BMP
    Thanks
    Yonela

    Hello Yonela!
    In the Transformation Step properties you can specify the exception handler in case the step fail. For more information, please check the help pages below
    Events:
    http://help.sap.com/saphelp_nw72/helpdata/en/76/9856e633464052a47270ea6c49640a/content.htm
    Modeling Exceptions and Exceptions Handling:
    http://help.sap.com/saphelp_nw72/helpdata/en/54/bf98c82cd84614a85cfda25d70b175/content.htm
    Best regards,
    Lucas Santos

Maybe you are looking for

  • Generic interface in abstract super class

    hello java folks! i have a weird problem with a generics implementation of an interface which is implemented in an abstract class. if i extend from this abstract class and try to override the method i get this compiler error: cannot directly invoke a

  • Excise Invoice Items are of different Register Type

    while doing GR for assets, system shows the following msg. Excise Invoice Items are of different Register Type What may be the reason? Pls guide Thanks

  • 8 core never run more that 50%

    I have a 8 core with 16g of ram is use final cut, and imovie ( sometimes) when I'm finished with a project I use compressor to output. Using Qmaster with 8 instances selected, My cp monitor runs at only 50% on all... I have look in this and other for

  • Upgrade from 2 to 13 oddity

    I have photoshop elements 12 & premiere elements 12 installed. I purchased the elements & premiere 13 upgrade edition and installed. I believed the upgrade version would install over the existing version 12 but its installed alongside version 12 inst

  • Missing MTS files?

    I am a new user of Premier Elements.  My first project is to create a sports highight video and I think I have just lost a season's worth of work. I am using Premier Elements 11. My process is to 1) "Drop" a video into a PE Project; 2) Trim the video