Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How can I catch a specific ORACLE error in my PRO*C application
Abiy ALEMU wrote:
> I would like to make something like
> EXEC SQL WHENEVER (SQLCODE = 6502) CONTINUE
>
> I know that I can't do that but I would like to have a possibility to
> continue the processing for a specific type of error and to exit for
> some other types of errors.
You can do it, just probably not in the manner that you would like. There are two ways:
if (sqlca.sqlcode == 6502){
/* your error handling code here */ }
This really isn't recommended and it isn't guaranteed to be the same in future releases (but then again, it isn't really likely to change unless Oracle comes up with a better way), but I've used it in the past to handle specific situations in which an oracle "error" really isn't an error within the context of what I am trying to do.
One thing you should really try to do is master the contents of the sqlca and the oraca structures. There are some useful data items there and you may be able to improvde your code by knowing how to use those data elements.
Ken Received on Tue Jul 27 1999 - 07:30:17 CDT