Retrieving line-number of the last error

Hello !
Is it possible to access the line number where the last error in a PL/SQL procedure occured ?
At example:
CREATE OR REPLACE PROCEDURE do_stupid
IS
tempNum Number;
BEGIN
     FOR i IN 1..5
     LOOP
          temp := sysdate;
     END LOOP;
     tempNum := 2;
     tempNum := tempNum / 0;
     tempNum := 3;
EXCEPTION
WHEN OTHERS THEN
     -- i want to access the line-number of the error "tempnum / 0"
END do_stupid;
Thank You
Florian

If you are just trying to debug one procedure, eliminating the exception section and running it from sql*plus will cause it to return an error message that includes the line number. But this won't work if you are trying to trap the error and log it in some table or some such thing.
SQL> CREATE OR REPLACE PROCEDURE do_stupid
  2  IS
  3    tempnum NUMBER;
  4    temp    DATE;
  5  BEGIN
  6    FOR i IN 1..5
  7    LOOP
  8      temp := SYSDATE;
  9    END LOOP;
10    tempnum := 2;
11    tempnum := tempnum / 0;
12    tempnum := 3;
13  END do_stupid;
14  /
Procedure created.
SQL> EXEC do_stupid
BEGIN do_stupid; END;
ERROR at line 1:
ORA-01476: divisor is equal to zero
ORA-06512: at "SCOTT.DO_STUPID", line 11
ORA-06512: at line 1

Similar Messages

  • How to read a file and save the line number of  the last line read?

    Hi,
    I am using RandomAccessFile and file as my class. I am trying to read a log file as it gets updated and print it out to a java window. i so far have the framework setup but dont know how to save the last line number so.
    i need this variable so i dont reprint out the same line numbers to the java window. please advise.
    thanks!

    hi,
    i now have the line number of the last line read, but now when i reopen the file, how can i skip that number of lines?
    thanks,

  • I would like to retrieve my messages for the last 2 weeks of February this year

    i would like to retrieve lost messages for the last 2 weeks of Feb 2015  from my iPad mini 2012  with IOS 8.2

    I subscribed to your feed and was unable to download episodes - I tried several including the latest. The error message was that the download was interrupted.
    I was able to download the latest episode in a browser, and to play it in Safari. Evidently your server is reacting badly to requests from the iTunes application; I have no idea why this should be the case and can only refer you to the people running your server.

  • How to get the last error for while loop?

    How to get the last error for while loop? I just want transfer the last error for while loop, but the program use the shift register shift all error every cycle.

    What do you mean by "get" and "transfer"?
    If the shift register is not what you want, use a plan tunnel instead.
    Typically, programmers are interested in the first, not last, error.
    Can you show us your code so we have a better idea what you are trying to?
    LabVIEW Champion . Do more with less code and in less time .

  • OracleSOA - File Adapter - Correct mechanism to get the line number from the file

    We are using Oracle SOA process to read data from a file, process the data and write it to the database. SOA process is created using Oracle File Adapter to read the data, Oracle BPEL to transform & process the data and Oracle DB Adapter to write the data into the database.
    Oracle File Adapter uses native schema to process the fixed length data in the file. The number of rows in the file may exceed more than 500,000, to support processing of large files we use chunk size in the file adapter as 4000 rows. In each read operation, file adapter reads the data that matches to the schema, there might be few rejected rows as well.
    Oracle File Adapter property - jca.file.LineNumber gives me only the line number till what line the data is read. Is there any way to get the line number in the xml message, which exactly matches to the line number in the file.?
    Flat File Format: (Every file has one header, trailer and multiple data lines),
    HEADER02 -
    L01
    L01
    L01
    TRAILER02
    Line number is one of the crucial requirement in the development of the SOA service, this is used to back trace the information from which source and line the data has come.

    Hi Anshul,
    Thanks for sharing your thoughts.
    I am using DB adapter to insert the data into db.
    While doing the xsl transformation I can get the index of the message using position(), but that is not the correct way as there can be rejected lines by the file adapter.
    Even if I maintain a local counter variable, it will not consider rejected lines and increment that, which is not correct.
    Thanks,
    Ravindra

  • How do I get the line number of the sales order and how do I save info?

    I am trying to create a form that is able to be called from a right click on the sales order matrix and will display some of the user defined fields associated with the line.
    I've managed to create a form and add a menu option to the right click but I'm now stuck because of the following:
    1. How to I know which line the user selected? I need the REAL Line Number from the RDR1 table because I need to use it on the data filter of the form.
    2. I hard coded a line to just to see if I can load a form and it appears to load and bind the data to the controls, but how do I save changes made? There are several text fields, combo boxes, and a picture control.

    Hi Coleman,
    1. The pVal returned form a menu event does no provide the LineId, but a pVal from a Item Event does. I suggest you use a DoubleClick or Control + Click on the Line to trigger an event that you can catch and use to launch your form.
    2. Please note that if the Sales Order line is closed you'll not be able to update the values. If it's not, then you need to instantiate a Sales Order document, get the correct document with the GetByKey method and update whatever fields you need.
                    Dim oSalesOrder As SAPbobsCOM.Documents = oCompany.GetBusinessObject(BoObjectTypes.oOrders)
                    If oSalesOrder.GetByKey(docentry) = True Then
                        oSalesOrder.Lines.SetCurrentLine(pVal.Row - 1)
                        oSalesOrder.Lines.UserFields.Fields.Item("U_MyUDF").Value = ""
                        oSalesOrder.Update()
                    End If
    Regards,
    Vítor Vieira

  • HT5961 I want to receive the verification code for the keychain but I was sent to unknown number because the last two digits do not represent my phone number

    I want to receive the verification code for the keychain but I was sent to unknown number because the last two digits do not represent my phone number, so how can I change it to receive it on my cell phone ?

    I found this in the iCloud Keychain FAQs:
    How do I set up iCloud Keychain on a new device if I don't have one of my other devices to approve from?
    If you don't have access to any of your other devices that are using iCloud Keychain, you can still set up iCloud Keychain on another device if you have these items:
    - Your iCloud Security Code
    - The device that is using the SMS-capable phone number you provided when you first set up iCloud Keychain. A verification code is sent via SMS to this phone number. If you don't have access to this number, contact Apple Support, who can verify your identity so that you can complete setup on your new device.
    - If you have these items, follow the iCloud Keychain setup steps documented above. Your iCloud Keychain will then be pushed from the cloud to the new device.
    So it seems that you would have to directly contact the Apple Support: http://www.apple.com/support/icloud/contact/

  • Get more info about the last errors in Oracle

    Hi all,
    There is a log in a live system where it is possible to see every minute the following error:
    Sweep Incident[48073]: failed, err=[1858]
    I know that error can happen mainly when:
    1. Trying to insert caracter field in a numeric column
    2. Using in the wrong way the function to_date()
    I need more information about that error, what can be causing the error in the system and why. Is it possible to see more information about the last errors in Oracle? For example, if a query produces an error... is it possible to see in Oracle the error and the query that caused the error?
    Hope you can help me.
    Thanks in advance.

    Thanks Niall.
    I'm not sure if I got you...
    What I found is that MMON makes snapshots of the database 'health' and stores this information in the AWR. So, it seems like in the database there could be a numeric column that is storing character fields, and when MMON works, it finds that error... is that right?
    I found the following information:
    SQL> select substr(s.username,1,18) username,
    2 substr(s.program,1,22) program,
    3 decode(s.command,
    4 0,'No Command',
    5 1,'Create Table',
    6 2,'Insert',
    7 3,'Select',
    8 6,'Update',
    9 7,'Delete',
    10 9,'Create Index',
    11 15,'Alter Table',
    12 21,'Create View',
    13 23,'Validate Index',
    14 35,'Alter Database',
    15 39,'Create Tablespace',
    16 41,'Drop Tablespace',
    17 40,'Alter Tablespace',
    18 53,'Drop User',
    19 62,'Analyze Table',
    20 63,'Analyze Index',
    21 s.command||': Other') command
    22 from
    23 v$session s,
    24 v$process p,
    25 v$transaction t,
    26 v$rollstat r,
    27 v$rollname n
    28 where s.paddr = p.addr
    29 and s.taddr = t.addr (+)
    30 and t.xidusn = r.usn (+)
    31 and r.usn = n.usn (+)
    32 order by 1;
    USERNAME PROGRAM COMMAND
    oracle@airvs1b (MMON) No Command
    SQL> select addr, pid, spid, username, serial#, program,traceid, background, latchwait, latchspin from v$process where program='oracle@airvs1b (MMON)';
    ADDR PID SPID USERNAME SERIAL# PROGRAM
    000000044A4E48A8 24 15372 oracle 1 oracle@airvs1b (MMON)
    TRACEID B LATCHWAIT LATCHSPIN
    ---------------- ---------- ------------------------ --------------- 1
    SQL> select
    2 substr(a.spid,1,9) pid,
    3 substr(b.sid,1,5) sid,
    4 substr(b.serial#,1,5) ser#,
    5 substr(b.machine,1,6) box,
    6 substr(b.username,1,10) username,
    7 b.server,
    8 substr(b.osuser,1,8) os_user,
    9 substr(b.program,1,40) program
    10 from v$session b, v$process a
    11 where
    12 b.paddr = a.addr
    13 and a.spid=15372
    14 order by spid;
    PID SID SER# BOX USERNAME SERVER OS_USER PROGRAM
    15372 1082 1 airvs1 DEDICATED oracle oracle@airvs1b (MMON)
    Is there any way I can see what MMON is doing and when is failing?
    Thank you very much.
    Edited by: user11281526 on 19-jun-2009 5:18

  • Can I get the serial number of the last I-Pod I synced on I Tunes if I no longer have the I-Pod because it has been stolen?

    Can i get the serial number of the last I Pod I synced with I Tunes if I no longer have the I Pod because it has been stolen?

    -> iPod: How to find the serial number
    If your iPod is not currently connected to your computer, but has been connected to your iTunes library before, follow these instructions:
    Hold down the Control key and choose Help > About iTunes (Windows) or iTunes > About iTunes (Mac).
    Release the Control key.
    As the iTunes and QuickTime version information scrolls, you will see the serial number of the last connected iPod as well as the last connected iPhone's serial number and IMEI.

  • Show the object and the line number, where the error happens in Forms

    Hi!
    Al lot of our programmer use the ugly when others clause to raise messages like "error <sqlcode> happens in ....". Often this hides the really error in some underlying procedures. Is it possible to call the error stack from forms like in 10g database dbms_utility.format_error_backtrace? Actually FRM-40735 hides all this information. This should be work for client and database pl/sql errors!
    With kind regards

    First of all, send every programmer in your organization a message to STOP doing that. I am afraid there is nothing you can do when you have to call some stupid code from your form that contains the when others then... sequence.
    Below is an email I sent out just two months ago. I'll share it with you:
    Hi _______,
    I looked over the _________ package to try to determine why it was so difficult to find the source of the problem. The problem was that the line number reported when the job failed was line 326, which is the Raise command at the end of the __xyz__ procedure.
    When someone writes:
          exception when others then raise;it causes line number reporting to fail when an unexpected Oracle error is encountered. Furthermore, the line does absolutely no good, because Oracle will automatically raise unhandled errors without that code.
    The only thing that code does is cause problems when someone looks for the source of a failure. Without that code, job failures can be located in just a few minutes.
    That same code sequence is repeated three times in the _________ package. The problem may also exist in the __abc___... functions that the _______.lookup_xxxl function calls, since no line numbers were reported from there, either. It would be very helpful if you would remove the problem code, and PLEASE instruct everyone on your staff to never use that sequence anywhere.
    - - - - - - - - - - - - - - - - - - - - - - end of email - - - - - - - - - - - - - - - - - - - - - -
    Now, in addition, you can trap FRM-40735 in your on-error trigger and then display the message found in DBMS_ERROR_TEXT. In fact, you might try the format_error_backtrace from there, too.

  • Transaction Notification to show 'Line Number' in the Error message

    HI guys
    I been trying to get this line no. to be shown in the error message, have not tried that, is this possible?
    i did  a Notification to check on the line level, however, due to many line items, user has to check one by one, is that any way to tell user which line is having the problem
    EM, Cheers

    Hi,
    Check this document:
    How to close a discussion and why
    Thanks & Regards,
    Nagarajan

  • How to find out the line which caused the runtime error in a SP?

    We have a situation like this.
    We are consulting company doing consultancy services on Oracle technologies.
    One of our clients have PL/SQL stored package.
    We found out by debugging the Oracle Forms front-end application that
    error is generated by a procedure inside this package.
    Problem is that this procedure has over 6000 lines.
    How do we figure out the line which caused the error?
    We tried putting messages in between, but not have been successful.
    Any help would be greatly appreciate.

    How do we figure out the line which caused the error?
    We tried putting messages in between, but not have been successful.
    What does that mean exactly?
    Typically you would instrument the code (especially for multi-step ETL/transform processes) to capture/log key information.
    Also, key sections of code would also be in their own BEGIN/EXCEPTION/END block so that you would know what block caused the exception.
    step_num NUMBER; -- what step is being executed?
    BEGIN
      step_num := 1;
      . . . do something
      step_num := 2;
      . . .  do something else
    EXCEPTION
      -- when you get here the 'step_num' variable will have the number of the step that caused the exception. Log it and then handle/reraise it.
    END;

  • How to find dynamically the current line number in the source file

    Is there a mechanism like __LINE__ and __FILE__ macro in C to get dynamically
    the current line number and file name of a source file?

    Don't know - but others have asked too. Have you searched the forum? For example:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=210496

  • Calculate the number of the last X minute peaks

    Hi.
    I am working on a SW which counts the peaks comes from a sensor.
    Using Producer/Consumer method , one in aquiring the data and the second is finding the peaks using peak detector VI.
    I was wondering if there is a simple way to calculate and show the number of peaks in the last X minutes . For example, in heartbeat there is average heart bear and the most updated last minute count of beats.
    Thanks.

    I would try it with a ring buffer only holding the time of a peak/pulse.
    Buffer size would be max_pulserate (200 ) times max_time.
    Calculating pulses per time frame would be a compare  and add array  
    A picture tells more :
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'
    Attachments:
    pulsemean.vi ‏19 KB

  • Netweaver not showing line number in the error file.

    Hi All,
    I am working on SAP NetWeaver 2.
    I am having a serious problem in here.
    What is happening is, In my code there is a Null pointer exception occurring frequently.
    In my log file I can see the file in which it is occurring but I cannot see the line no in which the nullpointer exception is coming.
    Is there any setting in netweaver which i should turn on to see the line no in which the error is happening.
    Thanks in Advance,
    Manny

    Hi Sam,
    Title means workflow title coming in the inbox or mail subject ?
    Anyways both the issues can be fixed in the WF itself.
    If you want to change the mail subject check your mail step and provide proper variable.
    for the workitem text you can change it form the task.
    Regards
    Bikas

Maybe you are looking for

  • OBIEE10g: extending a fact table with a custom fact

    Hello everyone! I have the following problem: I created a table with, let's say only two fields: primary key COMMISSION_LINE_ID and a measure called PAID. After joining my new table with the existing fact table on COMMISSION_LINE_ID both in the physi

  • 3D Object in PDF (Reader for iOS)

    I have an embedded U3D object in a PDF. When I open the PDF in Adobe Reader for iOS, the model is seen, but I cannot rotate it or zoom in on it. Are 3d models embedded in a PDF supported? Thanks!

  • Aged Reporting SAP 8.8

    We are just looking at upgrading to 8.8, I am aware of a couple of changes regarding the ageing reports. Is it true that the report will now bring through documents in there original currency despite them being setup as multi currency? We have have h

  • Check Activation Error Message

    I get this when I try to download from Overdrive to ADE 2.0, How do I activate??

  • AutoCommit Setting for the Microsft OleDB Provider for Oracle(MSDAORA)

    Hi, The default setting for the AutoCommit(MSDAORA) is "On". can any one please tell me how to set this Off. thanks