Home » SQL & PL/SQL » SQL & PL/SQL » Debugging
Debugging [message #218248] Wed, 07 February 2007 08:09 Go to next message
a_developer
Messages: 194
Registered: January 2006
Senior Member
Let's say I have a process that calls several package procedures with INSERTs, UPDATEs and DELETEs. The process takes 2 hours to complete. If the user encounters an error and just sends the ORA errmsg and errcode, what would be the best way to debug?? I have a couple of options which I think are tedious to implement so am asking your opinion:
1) Put log messages in between the code lines
2) Simulate the process by running on each line of code until the error pops up

What would be an ideal way to debug a process that runs PL/SQL programs???.. Thanks in advance..
Re: Debugging [message #218250 is a reply to message #218248] Wed, 07 February 2007 08:19 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Option 3 would have been the right option: Deliver your code with tracing capabilities, but it is too late for that now.

If you have not introduced some WHEN OTHERS exception handler, the user gets a stack trace containing program names and line-numbers, so it should be fairly easy to trace what went wrong and why.
Re: Debugging [message #218258 is a reply to message #218250] Wed, 07 February 2007 08:39 Go to previous messageGo to next message
a_developer
Messages: 194
Registered: January 2006
Senior Member
Quote:
Deliver your code with tracing capabilities, but it is too late for that now

Frank, can you please elaborate on this? It's not too late for my future programs Smile
Re: Debugging [message #218259 is a reply to message #218258] Wed, 07 February 2007 08:44 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Create a standard package for logging messages. If you combine this with a possibility to change the loglevel at runtime, you can switch between no logging (normal production situation), and probably several levels of granularity.
Check out apaches log4j as an example.
Re: Debugging [message #218264 is a reply to message #218259] Wed, 07 February 2007 09:11 Go to previous messageGo to next message
a_developer
Messages: 194
Registered: January 2006
Senior Member
Thanks! I was surfing for how to get the erroneous line of code. Was glad to find it: DBMS_UTILITY.FORMAT_ERROR_BACKTRACE.. Unfortunately, this is only available in 10g. Is there a workaround in 9i??
Re: Debugging [message #218266 is a reply to message #218264] Wed, 07 February 2007 09:33 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
search for who_called_me at asktom.
Previous Topic: exist in parent not in child
Next Topic: how to create users with admin option
Goto Forum:
  


Current Time: Wed Dec 07 05:01:50 CST 2016

Total time taken to generate the page: 0.05923 seconds