Unix Technical Forum

unable to catch Exception

This is a discussion on unable to catch Exception within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hi All, I have a .sql file with declare..begin ..exception(no_data_found and when others).. end; In the above procedure , ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 10:26 AM
sappi
 
Posts: n/a
Default unable to catch Exception

Hi All,

I have a .sql file with declare..begin ..exception(no_data_found and
when others).. end;

In the above procedure , I am making use(invoke) of one more procedure
which is using No_data_found exception and when_others.

The problem i am am facing is ,the main procedure is not catching the
exception as it is already dealt by the invoking(inside) procedure.

I want the exception to be catched by the outside procedure so that i
can log those errors into a table.

In this case how can we catch the exception again which is already
dealth by WHEN_OTHERS in the Inside procedure with out changing the
inside(invoked) procedure exception(as it is used by other procedures).

-sappi

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 10:26 AM
Michel Cadot
 
Posts: n/a
Default Re: unable to catch Exception


"sappi" <swapnareddy_09@yahoo.com> a écrit dans le message de news: 1147234411.608664.193910@i40g2000cwc.googlegroups. com...
| Hi All,
|
| I have a .sql file with declare..begin ..exception(no_data_found and
| when others).. end;
|
| In the above procedure , I am making use(invoke) of one more procedure
| which is using No_data_found exception and when_others.
|
| The problem i am am facing is ,the main procedure is not catching the
| exception as it is already dealt by the invoking(inside) procedure.
|
| I want the exception to be catched by the outside procedure so that i
| can log those errors into a table.
|
| In this case how can we catch the exception again which is already
| dealth by WHEN_OTHERS in the Inside procedure with out changing the
| inside(invoked) procedure exception(as it is used by other procedures).
|
| -sappi
|

Have a look at RAISE instruction.

Regards
Michel Cadot


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 10:26 AM
Sybrand Bakker
 
Posts: n/a
Default Re: unable to catch Exception

On 9 May 2006 21:13:31 -0700, "sappi" <swapnareddy_09@yahoo.com>
wrote:

>Hi All,
>
>I have a .sql file with declare..begin ..exception(no_data_found and
>when others).. end;
>
>In the above procedure , I am making use(invoke) of one more procedure
>which is using No_data_found exception and when_others.
>
>The problem i am am facing is ,the main procedure is not catching the
>exception as it is already dealt by the invoking(inside) procedure.
>
>I want the exception to be catched by the outside procedure so that i
>can log those errors into a table.
>
>In this case how can we catch the exception again which is already
>dealth by WHEN_OTHERS in the Inside procedure with out changing the
>inside(invoked) procedure exception(as it is used by other procedures).
>
>-sappi


begin
....
begin
...
exception
when-others then
....
raise -- reraise the exception
end;
exception
when-others then
-- write into table
end;
/

or (Less ugly)
convert the outer exception handler to an (autonomous) procedure and
call it everywhere. No need to reraise anymore.

--
Sybrand Bakker, Senior Oracle DBA
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 10:26 AM
Brian Peasland
 
Posts: n/a
Default Re: unable to catch Exception

Have you read the Oracle documentation on this issue? Please look at the
PL/SQL User's Guide:S

http://download-east.oracle.com/docs...b14261/toc.htm

Chapter 10 talks about Exception Handling. Pay particular attention to
the section titled "How PL/SQL Exceptions Propagate". After you've read
that, look at the next section titled "Reraising a PL/SQL Exception".

HTH,
Brian



--
================================================== =================

Brian Peasland
oracle_dba@nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 10:26 AM
DA Morgan
 
Posts: n/a
Default Re: unable to catch Exception

sappi wrote:
> Hi All,
>
> I have a .sql file with declare..begin ..exception(no_data_found and
> when others).. end;
>
> In the above procedure , I am making use(invoke) of one more procedure
> which is using No_data_found exception and when_others.
>
> The problem i am am facing is ,the main procedure is not catching the
> exception as it is already dealt by the invoking(inside) procedure.
>
> I want the exception to be catched by the outside procedure so that i
> can log those errors into a table.
>
> In this case how can we catch the exception again which is already
> dealth by WHEN_OTHERS in the Inside procedure with out changing the
> inside(invoked) procedure exception(as it is used by other procedures).
>
> -sappi


Demos of exception handling in Oracle can be found in Morgan's Library
at www.psoug.org.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:23 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com