Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

plsql question on printing the line number when an exception occours

Mac_Freak_RahulApr 26 2013 — edited Apr 26 2013
Hi All,

My database : oracle 10G

here is my question :

Explaining my problem using a simple procedure, such as :

create or replace procedure p_hello_world
as
[some variables declared]
begin
[lots of code here]
exception
when others
dbms_output.put_line('Exception occurred for procedure p_hello_world');
dbms_output.put_line('sqlerrm'||sqlerrm);
dbms_output.put_line('sqlcode'||sqlcode);
-- suppose I want to print the line number where the exception is occurred, could I do that, if yes please help me with this
end;

Now this is the same construct that I am using for my utility, I have a comment in the exception block above where I need to print the line number wherever the exception has occurred, now since I am using when others clause, my procedure would always succeed even if some exception occurs, but using this technique I am not able to quickly debug my code however printing the line number would help me a great deal, please help me with this as its going to save me from great trouble.

Regards
Rahul
This post has been answered by William Robertson on Apr 26 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 24 2013
Added on Apr 26 2013
6 comments
825 views