Capturing trace of exception

Suppose following stored procedure:
PROCEDURE TEST_PRC
IS
BEGIN
RAISE VALUE_ERROR;
END;
If I call this procedure in Sql*Plus, I get:
BEGIN test_prc; END;
ERROR in line 1:
.ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SCH_PERSONEN.TEST_PRC", line 4
ORA-06512: at line 1
I can see exactly on which line the exception was raised: line 4.
I can see this linenumber also in Sql*Navigator or in de stacktrace of the SqlException in a Java-program.
But how can I catch this information to store in a logtable ?
When I change the stored procedure as follows, I get only the number of the line where format_call_stack is called.
But I want the number of the line where the exception is raised !!!
PROCEDURE TEST_PRC
IS
BEGIN
RAISE VALUE_ERROR;
EXCEPTION
WHEN VALUE_ERROR THEN
DBMS_OUTPUT.put_line(SUBSTR(DBMS_UTILITY.format_error_stack || DBMS_UTILITY.format_call_stack, 1, 255));
END;
The output in Sql*Plus is:
ORA-06502: PL/SQL: numeric or value error
----- PL/SQL Call Stack -----
object line object
handle number name
2ae87f14 7 procedure SCH_PERSONEN.TEST_PRC
291f19b4 1 anonymous block

Start at the top and work your way back. If the error was in a class you did not write, read thru the trace until you get to the class you wrote and figure out what might be wrong there that could have caused the problem. Other than that, Norweed is right in saying it is a case by case basis.

Similar Messages

  • To trace the exceptions.

    i want trace the exceptions like invalid cursor state exception instead of sql exception.how to ?is there any numberings.

    If I understand the question....
    "invalid cursor state" comes from outside of java. There is no implicit way to get a trace. For certain external sources to jdbc there are ways to trace results there. For example in ODBC there is a trace log.

  • Capturing error in Exceptions Block in a PLSQL Procedure

    Hi,
    I am creating a procedure where i need to update a table with some constraints.
    i need to update atleast a million records with data from another table.
    but here is the catch while updating million records, there may be some records which wont be vaild because of the constraints and cannot be updated and hence will give an error.
    but in my procedure i want to write an exception block where it captures the error, ignores the error and keep coninuing the procedure and update all the remaining records instaed of getting hanged at the point of erorr.
    How can i do this.
    I know i can disable the constraints in the table.
    but i want the constraints enabled, so that the errors are trapped and skipped and only the records that are valid are updated.
    Can seomone help me write this exception block which does this function.
    Thanks,
    Philip.

    Hi,
    I used the exception bloack as u said.
    i have a sample of 20 records and i know the 11th record is not valid and should be inserted in a different way from the rest 19 records.
    so i ran the same query with the exceptions block.
    but what happened, until 10th record everything was fine.
    on the 11th record the execution went into the exceptions block and executed whatever was there in the exception block, but then the script just exited after exception block, it did not go back to fetch the remaining records from 12th unitl 20th.
    How can i fix this.
    Philip.

  • Capture Origin of Exception: PageLifecycle

    I've altered my project to include classes that modify exceptions that are thrown. Like the SRDemo example, I have ErrorHandler, PageLifecycle, PhaseListener, and KnowErrorStopException classes. In the PageLifecycle class, I can catch and modify the exception being thrown, but I would like to include the origin of the error. Is there any way to capture the name of the page that the error is being thrown on? Or is there a way to capture the name of the table or bc view that the error is comming from?
    Thanks,
    Tim

    1) Does the OoM happens while instantiating the buffered image, (which probably tries to allocate a big continuous native array of pixels)?
    Or the Graphics object (same reason, though the Graphics is probably just an empty shell over the big pixel array)?
    2) In which format do you need to save the image? Do you only need to be able to read it again in your own program?
    If yes to both questions, then a pulled-by-the-hair solution coud be to instantiate your own Graphics subclass (no Buffered Image), whose operations would save their arguments directly to the image file, instead of into a big in-memory model of the panel image.
    If the output format is a standard one though (GIF, JPG,...), then maybe your custom Graphics's operations could contain the logic to encode/compress as much as possible of the arguments into an in-memory bytearray of the target format?
    I'm not very confident though; I d'ont know the GIF or JPEG encoding, but I suspect (especially for JPEG) that you need to know the "whole" image to encode it properly.
    But if the target format supports encoders that work on the fly out of streams of bytes (e.g. BMP ) then you can use whatever compress/uncompress technique you see fit (e.g. RLE ): you know the nature of the panels, you may be aware of some optimizations you may perform wrt pixels storage. prior to encoding (e.g., bug empty areas, predictable chessboard pattern, black-and-white palette,...).
    Edited by: jduprez on Sep 19, 2009 7:33 PM

  • Trace line exception Lightswitch app C#

    Hi,
    I am developping a web lightswitch application using C#. I am trying in the production environment to trace the line of code where an exception is fired. Nothing has worked for me. Can anyone help ?
    Thanks 

    HI firsni,
    If you want to get line number from Exception using C#, you can refer to code snippet below.
    try
    throw new Exception();
    catch (Exception ex)
    // Get stack trace for the exception with source file information
    var st = new StackTrace(ex, true);
    // Get the top stack frame
    var frame = st.GetFrame(0);
    // Get the line number from the stack frame
    var line = frame.GetFileLineNumber();
    Hope it helps.
    Best regards,
    Angie
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Capturing trace() output

    Does anyone know if there's a way to capture the output of
    trace()? I'm trying to display trace statements in my application
    for debugging purposes. I know I can use the debugging console in
    Flex Builder or view the log files directly, but this approach has
    its advantages for our situation. Any suggestions would be
    appreciated. Thanks.

    Would a sql based solution (not from the OLAP worksheet tool/utility) work for you?
    DECLARE
    a_out varchar2(2000);
    BEGIN
    a_out := '';
    dbms_aw.aw_attach(name=>'USER1.AW1',forwrite=>false);
    dbms_aw.run(cmd=>'dsc DIM1', output=>a_out);
    dbms_output.put_line('AW cmd output (object DIM1): '|| a_out);
    dbms_aw.aw_detach(name=>'BIA_RTL_OLAP.PSLSINV');
    END;
    **************

  • Get the entire stack trace of exception ?

    Hi!
    If the JVM prints this :
    Caused by: java.sql.BatchUpdateException: ORA-00001: unique constraint (FOO.BAR) violated
    at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:367)
    at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:9040)
    at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:517)
    at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:58)
    at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
    ... 73 more
    then how do I get the missing 73 lines ?

    Why would you want to? they are shorthand indicating that they were thrown from the same method: From the API Docs
    Note the presence of lines containing the characters "...".
    These lines indicate that the remainder of the stack trace for this exception matches the indicated number of frames from the
    bottom of the stack trace of the exception that was caused by this exception (the "enclosing" exception).
    This shorthand can greatly reduce the length of the output in the common case where a wrapped exception is thrown from same method
    as the "causative exception" is caught. ~Tim
    Message was edited by:
    SomeoneElse
    Message was edited by:
    SomeoneElse

  • JDialog subclass for optionally showing stack trace from exceptions?

    hi,
    does anyone know of some code/jar that includes a widgit that displays an error message, and has a button for toggling an exception stack trace on or off?
    this would be like the segmentation fault dialog on windows except instead of the grungy register contents you'd get the grungy stack trace..
    just trying to avoid having write one myself.. :)
    thanks,
    asjf

    this sounds like one:
    http://www.yworks.com/products/yDoc/showcase/batik-1.5/org/apache/batik/util/gui/JErrorPane.html

  • CORBA properties, turning off stack trace on exception

    Is there a property when using the Sun ORB that will turn off the stack trace when a system exception occurs. I am already handling the system exceptions, so I really don't need the call stack from a 201 error.
    Thanks!
    evic

    Thank you for the clarification, Rob. I'll file an enhancement request
    right away.
    Christophe
    Rob Woollen wrote:
    WLS will log all transaction rollbacks. You'll have to file an enhancement
    request with [email protected] if you want to supress that behavior.
    -- Rob
    Christophe Warland wrote:
    A part of our architecture is based on rollbacks in an entity bean
    (RequiresNew) that we control from a stateless sessionbean
    (NotSupported). Everything works great, including the recovery mechanism
    inside the stateless sessionbean. We are very happy with that.
    However, WebLogic prints out an Exception stack trace everytime a
    rollback occurs, eventough our code in the SLSB is managing rollback and
    recovery by catching the RemoteException thrown by the container.
    So, how do I turn off that StackTrace without introducing transaction
    semantics inside my SLSB?
    Thanks,
    Christophe

  • Unable to capture trace, when user logs in throuigh Web Interface

    The Trace shows 'No Records Found', when user logs in through Web Interface of CRM. But there is Trace found, when the same user logs in through logon pad and carries out normal actvities.
    sufficient auth. is provided.
    Is there any setting in ST01, through which i can get trace , when user logs in through Web Interface
    Regards

    ST10 traces 1 instance only.
    Your CRM web interface could use another instance than your backend. Go to transaction SM21, choose the appropriate server and run ST10 again.
    Succes!
    Kind regards,
    Lodewijk Borsboom

  • Capturing actual JDBC exception in BPM

    I have a scenario wherein i am inserting data in sql server syncronously using the xml insert structure.
    I have a BPM in place to do error handling, so that whenver any exception occurs, exception branch is executed,
    however, in the exception branch am not able to detect wht the error was. Like was the error related to connectivity or related to DB that something failed because of BD constraint.
    How can I trap the actual JDBC error in my exception handling..

    Hi,
    As you are using BPM and the call is Sync,you can get the response back if everything is fine. If not it will throw exception.
    If you want to detect the Application errors, one option is using Stored Procedures in the DB side, so that it will respond you back with insertion failed bacause of duplicate entry etc...
    If you want to handle , exceptions for connectivity issuses, you can make use of ALerts configured for JDBC adapters.. So you can create the Alerts like that.
    To know more-
    http://help.sap.com/saphelp_nw2004s/helpdata/en/33/4a773f12f14a18e10000000a114084/content.htm
    Hope this helps
    Regards,
    Moorthy

  • General Stack Trace and Exception Question

    I hope this is the correct forum to post to ... well here goes...
    The Big Picture:
    I�m using the org.xml.sax package (along with their subsequent �helper� and �ext� packages) to parse huge XML files.
    Some references:
    DefaultHandler -> org.xml.sax.DefaultHandler (Default base class for SAX2 event handlers)
    CustomHandler -> mypackage.CustomHandler (which extends the above DefaultHandler)
    SAXException -> org.xml.sax.SAXException (thrown by many methods defined in the DefaultHandler)
    The story:
    I�ve made a class which extends the DefaultHandler class; (CustomHandler). The DefaultHandler class has a bunch of methods declared in it that I overwrite, which all claim to throw these SAXExceptions. My overwritten methods defined in CustomHandler had also been written to throw those SAXExceptions.
    My Overwritten Methods: (you�ll see why the �throw� part is commented a little later)
    //Methods in SAX DocumentHandler
        public void startDocument(){//throws SAXException{
        public void endDocument(){//throws SAXException{
        public void startElement(String uri, String localName, String qName, Attributes attrs){//throws SAXException{
        public void endElement(String uri, String localName, String qName){//throws SAXException{
        public void characters(char buf[], int offset, int len){//throws SAXException{
    The Code Executes like This:
    try{
         File xmlFile = new File(getFileName());
         CustomHandler myHandler = new CustomHandler();
         saxParser.parse(xmlFile, myHandler); //<- Important Line
         myHandler.reportSomeXmlInfoAboutTheFile(); //<- Ignore this command
    }catch(ParserConfigurationException pce){
                pce.printStackTrace();       
    }catch(SAXException sax){
                sax.printStackTrace();
    }catch(IOException ioe){
                ioe.printStackTrace();
    }Sample Stack Trace: (The ArrayIndexOutOfBoundsException was set up to be thrown for the sake of discussion)
    java.lang.ArrayIndexOutOfBoundsException: 5
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:691)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:281)
    at saxparserexercise.DriverClass.exercise(DriverClass.java:58) //<- Last (un Native to ME � not java) execution stack point
    at saxparserexercise.Main.<init>(Main.java:38)
    at saxparserexercise.Main.main(Main.java:59)
    The Problem:
    Its about my stack traces� they all map through the above noted �Important Line� instead of through my overwritten methods in CustomHandler (where I cause the ArrayIndexOutOfBoundsException) So, therefore I thought I�d try commenting out those �throws SAXException� parts in the method declarations of my CustomHandler class� Diddn�t change a thing. Thus my question is�
    The Question:
    What changes or modifications can I make such that the Stack Trace I receive will map to exactly where the problem occurs in my code� does that make sense?

    I suspect it may be because your version of Catalina was compiled without debugger support. From what I remember this strips line numbers from generated class files.
    You'll need to download either a debug-enabled version of Catalina, or pull down the source and rebuild the system.
    Unless I'm barking up the wrong tree.
    J

  • Trace NoClassDefFount Exception pls help

    Hello,
    I try to run trace form the console but I always get a NoClassDefFoundException.
    The Trace files (Trace.java/class EventThread.java/class ...) are in the directory: D:\emundo\Debugging\example\trace
    The class to trace is also under the specified path (hello.class + hello.java).
    Now I try to trace hello via console:
    java -cp "C:\Program Files\Java\jdk1.6.0_16\lib\tools.jar";D:\emundo\Debugging\example\trace\ Trace hello
    But get
    java.lang.NoClassDefFoundError: hello
    I hope you can help me to solve this problem...
    Thanks and best regards
    Alex

    Is that message in the Server Log ?
    If not, please check the server log and post what you can see
    Thanks

  • Handling long stack traces in exceptions

    If something goes wrong in my program... I get about 150 line stack trace caused by overlayed modal dialogs and swings shameless use of methods. My question is that how will I ever fiqure out what went wrong at the few first lines?

    hi,
    if you're working under Linux, just press SHIFT and PAGE UP. If you're working under Windows you'll have to log the console output as follows:
    1. One of the first operations in your main method should be this:
    System.setErr(System.out);2. The command line option you use to start the virtual machine should look like this:
    java [options,...] MyClass > log.txt
    This will create the file log.txt where everything sent to the standart output will be saved.
    PS: You may get some problems when running this more than once during one windows session because Windows sometimes doesn't close the file. Open files can't be overwritten and so you'll have to restart whenever this occurs.
    best regards, Michael

  • How to capture the exact SQL exception for failure to connect to database

    Hi, i would like to capture the exact exception for failure to connect to a Oracle 9i database (via JDBC). I learnt that there is specific code or exception that can be captured, so that a more proper error message can be thrown out like "Failure to connect to database" can be displayed. Anyone know how to go about doing it? thanks

    That depends on your database vendor, I believe. (Unless there's a SQL standard for states and codes that I'm unaware of.)
    Personally, I wouldn't worry about "catching" a particular code. (You've already caught the exception - that's the best you can do.) I'd report the error code and state and just look up what it means when I got one.
    Hopefully you won't be catching exceptions. They're supposed to be rare. - MOD

Maybe you are looking for

  • How can I export the report to Excel or CSV format in Rational(Java)?

    <p>Dear all,</p><p>Now I develop CR report integrate with Web application, I use Ratioanl(RAD) to develop. And I want to export the report to Excel/CSV format, but always failed.</p><p>If I force it export CSV file in the system, when I use MS office

  • Why are the fonts displayed larger in Mountain Lion?

    Hi, I have upgrade a 4 year old (ish) iMac from Snow Lepoard to Mountain Lion, and all my documents now seem to be display the fonts larger post upgrade then they did before the upgrade. For example I have a spread sheet with an Arial 10 font, the fo

  • New York Ink - not able to download

    I was looking through the Vision TV channels and came across NY Ink Series 1. Being a fan of the other Ink Series (London, Miami, LA) I thought I would have a watch of an epside but when I go to download one it tells me I will have to subscribe? I cu

  • Xmlparserv2 and xalan

    Hi I have deployed an XML based application on Oracle9iAS Release 2 (v9.0.2). Application Server is forcing me to user Oracle's xmlparserv2 (and saxon) whereas my application has been written according to xalan (and xerces). Can some one help me as h

  • How to deactivate authorization check?

    hi , how to deactivate  Authorization check? thanks. reddy.