Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> How do I detect a server down in PL/SQL?
I need to detect when an insert fails due to a server being down. I have the
following code (most of it snipped, names changed to protect the innocent):
vExists number;
vAppType number;
begin
if vExists = 0 then
exception
when others then
pSQLCODE := SQLCODE;
pSQLERR := SQLERRM;
end InsertRecord;
Here is the code that calls this procedure:
InsertRecord(pID,pDateFiled,pAppType,pTitle,pUser,vErrorCode,vErrorMsg);
if vErrorCode > 0 then pSQLCODE := vErrorCode; pSQLERR := vErrorMsg; raise app_error; end if;
Nothing too fancy. The question I have is: is there a specific error code that is raised if the connection to the database link cannot be established? There is a known problem with the server we try to connect to, the problem being it goes down often. I would like to put that information in the procedure so that users know what is happening (ie it's not my fault).
Thank you,
Roger
Received on Wed Jul 09 2003 - 13:48:10 CDT