Re: Exception Handling!!!!

From: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 19 May 2006 09:39:26 -0800
Message-ID: <446df4be$1_at_news.victoria.tc.ca>


Wallace (princevictor.moses_at_gmail.com) wrote:
: Hai All,

: I have a function which contains a collection of select and insert
: statements and I am also able to handle the exception and get the error
: code and error message using SQLCODE and SQLERRM respectively. But the
: problem is I am not able to figure out in exactly in which line or with
: which column the exception occurs. I s there is any method avalable for
: getting the detailed error message.
: Kindly Help...
: Thanx in advance....
: Looking for the response....

	begin
		select x into y from t;
		select z into w from f;
		insert into t values(1,2,3);
	exception
		-- which line had the error ?
		...
	end;

	

If you mean the line number like in VB then no. Either wrap each statement that can fail in a handler or add your own flag to say what you are doing before you do it, and use that flag later.

-1-

		begin	
		  select x into y from t;
		exception
			when ...
		end;
		begin
		  select z into w from f;
		exception
			when ...
		end;

-2-

	declare
		doing varchar2(100) := 'Nothing yet';
	begin
		doing := 'select from t';
		select x into y from t;
		...
		doing := 'insert into t';
		insert into t values(1,2,3);
	exception
		...
		'error while ' || doing;
		...
	end;
Received on Fri May 19 2006 - 19:39:26 CEST

Original text of this message