Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: error handling in PL/SQL

Re: error handling in PL/SQL

From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Wed, 14 Aug 2002 17:21:28 GMT
Message-ID: <3D5A9194.8E70FA34@exesolutions.com>


Daud wrote:

> I have a procedure that looks something like below.
>
> create or replace procedure AAA ....
> cursor mycursor is select ... from mytable_at_remotedb;
> ....
> begin
>
> open mycursor;
> ...
>
> end;
>
> The problem I am having is that sometimes the remote db is not up and
> I would like to be able to handle the error that would be raised
> gracefully. How do I do that? I have tried to put EXCEPTION in the
> 'begin....end' block but that did not worked. Any way to solve this?
>
> rgds
> Daud

CREATE OR REPLACE PROCEDURE AAA IS

i                  PLS_INTEGER;

LinkDown EXCEPTION;

BEGIN
   BEGIN

      SELECT COUNT(*)
      INTO i
      FROM all_tables_at_someplaceelse;
   EXCEPTION
      WHEN OTHERS THEN
         RAISE LinkDown;

   END;    ... the rest of your code here

EXCEPTION
   WHEN LinkDown THEN

      ... exit gracefully
END; Daniel Morgan Received on Wed Aug 14 2002 - 12:21:28 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US