Exceptions.Exceptions are a common mechanism in Object Oriented languages, but they aren't restricted to such languages. The relationship is because in the OO world, the idea of destroying local objects when an exception occurs fits nicely in that paradigm. An exception may be described as an special object that's created and activated when an unusual condition is met. In OO languages, raising an exception means the stack is unwound to the point where an appropriate exception handler is located, skipping all the code in the middle. This technique is useful to defer to other code section an special condition the current code has no way of dealing with. That code section is usually the calling function. In IB, you first need to define an exception with a unique name across the database and assign to it a message. All common definition tasks in SQL are carried out through the CREATE reserved word followed by specific words according to the command's syntax. In this case, it's Once you have your exception, it's available to all triggers and stored procedures in the database. Then you can use it by means of the syntax In the case of selectable procedures that also perform data changes, an exception only undoes the changes after the last SUSPEND command, but because you'll receive the error in the client application, you can roll back the complete transaction. |
This page was last updated on 2000-07-02 01:16:10 |