Home » RDBMS Server » Server Administration » Re: What is use of 'raise' command in pl/sql
Re: What is use of 'raise' command in pl/sql [message #374348] Thu, 07 June 2001 01:58
GIRIDHAR KODAKALLA
Messages: 92
Registered: May 2001
Member
Hai,
The use of raise is as follows:-

Raise can be used to raise the exception to the calling environment
or to the nearest calling block when you dont want to handle that
error or condition in your block.The control will propogate to the
calling environment or to the calling block.

In the execution block, you cannot use plain raise like
RAISE;
This is not allowed. You have to raise with system
defined exception ( i did not try with user defined exception,may be
it is also allowed).

Whereas in exception block, you can just call
RAISE;
without any specific exception.
The reason for calling the RAISE in Exception block is :

Suppose i have an procedure and in the exception block i
want to insert the error message,user name and other details
related to error.Unfortunately i got the Error NOT_LOGGED_ON.
Hence i cannot insert the Error details into the table as
I am NOT_LOGGED_ON. Hence it will raise another exception.
So this will go into infinite loop.
In order to pass the control to the calling block under such
situations, we can call RAISE.

HTH.

Cheers,
Giridhar Kodakalla
Previous Topic: indextype
Next Topic: How do I achieve range of values using Decode
Goto Forum:
  


Current Time: Fri Jul 05 13:33:28 CDT 2024