x

Can we create our own exceptions in oracle?

I am having a pl/sql procedure. I am handling exceptions in exception block. There are couple of logical errors which may occur during the process.

So, whenver there is a situation occurs other than oracle exceptions, I want to handle it programatically, and want to pass a reasonable message.

So, I am thinking whether we can create our own exceptions or not?

Is there anyway we can do this?

more ▼

asked Dec 16, 2009 at 05:22 PM in Default

avatar image

OraLearner
1.3k 82 88 92

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

Error numbers in the range -20000..-20999 are reserved for the user-defined errors. You can easily raise your own error and catch it later as an exception:

--- This code will throw ORA-20010

raise_application_error(-20010, 'Operation failed');

more ▼

answered Dec 16, 2009 at 05:36 PM

avatar image

Tariq Rahiman
665 2 4 7

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x424
x56

asked: Dec 16, 2009 at 05:22 PM

Seen: 1240 times

Last Updated: Dec 16, 2009 at 05:22 PM

Copyright 2016 Redgate Software. Privacy Policy