The internally defined exceptions are thrown by the engine in response to corresponding errors that require execution to stop. They cover a very large range of conditions, including every kind of constraint violation, arithmetic and string overflows, references to missing objects, data corruption, and so on. The SQLCODE and GDSCODE exceptions are the same ones that are used when errors occur during dynamic SQL operations.
Custom exceptions, which are available only in PSQL modules, do not need to duplicate the work of the internally defined ones. Define your exceptions for use when you want your code to detect error conditions that break your business rules. The three exception types are depicted in Figure.
Standard PSQL response to exceptions
We encountered an example in Chapter Stored Procedures in which a custom exception was used in a trigger for the purpose of stopping an event, where letting it continue would break a business rule. In this case, a stored procedure was taking care of tidying up dependencies left in the organizational structure by the departure of an employee. It was declared like this:CREATE EXCEPTION REASSIGN_SALES
At the point where the exception is to be used, the procedure checks whether the employee appears as the sales rep on any outstanding sales orders. If so, the custom exception is used to end the procedure. Of course, the exception, if it occurs, causes all of the other tasks performed by the procedure to be undone....
There are cases where it is possible to use the custom exception as a way to intervene, deal with a problem condition, and let the procedure continue. We can trap the exception and write code to handle it, right there in the procedure. The next section examines how this trap-and-fix technique can be used to deal with our reassign_sales exception.
Firebird Related Interview Questions
|RDBMS Interview Questions||MySQL Interview Questions|
|Linux Interview Questions||Mac OS X Deployment Interview Questions|
|Windows Administration Interview Questions||Windows Server 2003 Interview Questions|
|SQL Interview Questions||NoSQL Interview Questions|
|Advanced C++ Interview Questions|
Introduction To Client/server Architecture
About Firebird Data Types
Date And Time Types
Blobs And Arrays
From Drawing Board To Database
Creating And Maintaining A Database
Firebird’s Sql Language
Expressions And Predicates
Querying Multiple Tables
Ordered And Aggregated Sets
Overview Of Firebird Transactions In
Programming With Transactions
Introduction To Firebird Programming
Developing Psql Modules
Error Handling And Events
Security In The Operating Environment
Configuration And Special Features
Interactive Sql Utility (isql)
Database Backup And Restore (gbak)
Housekeeping Tool (gfix)
Understanding The Lock Manager
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.