Home » Developer & Programmer » Forms » Display Line number where exception raise (Forms 10g, Windows platform, oracle 10 database)
Display Line number where exception raise [message #496286] Fri, 25 February 2011 16:05 Go to next message
balji_dxb
Messages: 37
Registered: October 2007
Member
We have Forms 10g for our application.

When i raise a exception in a procedure / trigger, i want to show the line number where the exception happened. is there any builtin to show that.

For eg

Exception when others
message('Error in this procedure');
raise;


I want the above exception to raise with line number also. How do i do it. I need some built in procedure in forms.

Please suggest
Re: Display Line number where exception raise [message #496288 is a reply to message #496286] Fri, 25 February 2011 16:28 Go to previous messageGo to next message
balji_dxb
Messages: 37
Registered: October 2007
Member
How do i display the line number of a particular in forms, dynamically. Like error in line 5
Re: Display Line number where exception raise [message #496424 is a reply to message #496288] Mon, 28 February 2011 03:49 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
DBMS_UTILITY.FORMAT_ERROR_STACK may help - can't try it my self at the moment.
However I think you may be out of luck. Procedures in the DB provide line numbers when they error but I'm not convinced procedures/triggers in forms can do that.
Re: Display Line number where exception raise [message #496434 is a reply to message #496286] Mon, 28 February 2011 04:22 Go to previous messageGo to next message
Michel Cadot
Messages: 68684
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
I want the above exception to raise with line number also. How do i do it. I need some built in procedure in forms.

Just remove the (silly) WHEN OTHERS clause and you will have the line number.

Regards
Michel
Re: Display Line number where exception raise [message #496438 is a reply to message #496434] Mon, 28 February 2011 04:29 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
You won't. Forms doesn't by default display line numbers of errors unless they came from DB procedures. You can write procedures/functions and triggers that are local to the form but they don't give line numbers when they error. I'm not convinced they ever can but can't check as I don't have a working forms installation.
Re: Display Line number where exception raise [message #496512 is a reply to message #496438] Mon, 28 February 2011 12:08 Go to previous messageGo to next message
balji_dxb
Messages: 37
Registered: October 2007
Member
@cookiemonster: DBMS_UTILITY.FORMAT_ERROR_STACK is only for database, but i need it in forms. i am using forms 10g. My assumption is when we compile a form and if there is some syntax error then forms gives the line number, similarly shouldn't have a built in to read the line number?.
Re: Display Line number where exception raise [message #496513 is a reply to message #496512] Mon, 28 February 2011 12:21 Go to previous messageGo to next message
balji_dxb
Messages: 37
Registered: October 2007
Member
"Just remove the (silly) WHEN OTHERS clause and you will have the line number."

@michel: Can you please explain.
Re: Display Line number where exception raise [message #496521 is a reply to message #496513] Mon, 28 February 2011 14:06 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
If you catch an error with an exception handler, any exception handler, and re-raise it, then the original line number, assuming it was available in the first place, is lost.
Re: Display Line number where exception raise [message #496522 is a reply to message #496512] Mon, 28 February 2011 14:09 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
balji_dxb wrote on Mon, 28 February 2011 18:08
@cookiemonster: DBMS_UTILITY.FORMAT_ERROR_STACK is only for database, but i need it in forms. i am using forms 10g. My assumption is when we compile a form and if there is some syntax error then forms gives the line number, similarly shouldn't have a built in to read the line number?.


You would have thought there would be, but I'm not aware of one. Maybe someone else knows.
Re: Display Line number where exception raise [message #496683 is a reply to message #496522] Tue, 01 March 2011 22:39 Go to previous messageGo to next message
Velcroman
Messages: 5
Registered: February 2011
Junior Member
Displaying line numbers in FORMS 10g is a pain. I write in line numbers
eg
declare
debug_line number;
--
begin
debug_line := n;
--
code_line;
code_line;
code_line;
code_line;
--
debug_line := n + (??);

Exeception
When others
then
message('Error in trigger/procedure on line '||debug_line||' '||sqlerrm); /* the bug_line holds the last value entered ...
therefore the error must be between that
debug_line and the next. Ruff as guts but is does work.*/
end;
Re: Display Line number where exception raise [message #496698 is a reply to message #496683] Wed, 02 March 2011 00:09 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'd say that running the form in debug mode is a simpler way to achieve the same. OK, there was exception. You know which program unit it was. Set a breakpoint in there, run in debug mode. Most of the times it takes a few clicks to narrow the problem.
Previous Topic: Alternate for OLE in unix application server
Next Topic: how can i populate record using LOV value
Goto Forum:
  


Current Time: Tue Sep 17 16:22:07 CDT 2024