| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Raising exceptions from PLSQL to Java
Thanks, Thomas, for the input. I goofed when I originally tested
exception processing. I put the "raise application error" logic in a
procedure which deleted records. I mistakenly assumed that Oracle would
raise an exception if you tried to delete a record that did not exist.
Code:
BEGIN
delete from users where user_id = user_id_in;
EXCEPTION
WHEN OTHERS
THEN
RAISE_APPLICATION_ERROR (-20001, sqlerrm)
END;
bill milbratz
In article <bv9n6sonndlohjjs37or7cmkbfa8kjgli8_at_4ax.com>,
tkyte_at_us.oracle.com wrote:
> A copy of this was sent to billmil_at_my-deja.com
> (if that email address didn't require changing)
> On Thu, 30 Dec 1999 17:58:07 GMT, you wrote:
>
> >Can a PL/SQL program raise an exception to a calling Java program
(i.e.
> >running on the server)?
> >
> >I've tried using both RAISE and RAISE_APPLICATION_ERROR in the
> >exception handling section of the PLSQL code. Neither seems to work.
> >
> >Any suggestions?
> >
> >Example PLSQL code:
> > EXCEPTION
> > WHEN OTHERS
> > THEN BEGIN
> > RAISE_APPLICATION_ERROR (-2001, SQLERRM);
> > END;
> >
> >thanks.
> >
> >
> >
> >Sent via Deja.com http://www.deja.com/
> >Before you buy.
>
> What do you mean "neither seems to work". It causes an error to be
sent backup
> to the java program that will manifest itself as a SQLException in
java.
>
> can you post a non-working example of the java code?
>
> --
> See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to
Oracle8i'...
> Current article is "Part I of V, Autonomous Transactions" updated
June 21'st
>
> Thomas Kyte tkyte_at_us.oracle.com
> Oracle Service Industries Reston, VA USA
>
> Opinions are mine and do not necessarily reflect those of Oracle
Corporation
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Fri Jan 07 2000 - 10:54:20 CST
![]() |
![]() |