user defined exception


user defined exception

In oracle there is a way to make user defined exception .
It is useful when there is need to catch more business related
problems rather than just the traditional exception such as 'not found' or 'divide by zero'
suppose we want an exception to be
raised for a invalid entry(i.e. business specific) when inserting data into a table.
The oracle way of doing it is as follows.

1st step:- declare a variable of type exception.

invalid_entry EXCEPTION;

2nd step:-In the EXCEPTION block define the user defined exception

WHEN invalid_entry THEN

..................... ;

3rd Step:-
raise the exception in the block you need.

RAISE le_invalid_entry;

But I don't find any way in Teradata to do this.

Is there any way in achieving that

Re: user defined exception

The stored procedures orange book describes a way in which you can make use of an external stored procedure to generate exceptions. You might want to take a stab on that example ...