Steps in creating oracle non-predefined exception handlers

Assignment Help Database Management System
Reference no: EM131066620

Q1. Explain the steps in creating Oracle non-predefined exception handlers and user defined exception handlers.

Q2. Respond to the following;

Cite References

Oracle non-predefined exception handlers allow exception handling for Oracle numbered errors that do not have predefined exceptions. This requires associating the error number with a user developed exception. This is accomplished by declaring the exception, then using a pragma statement to tie the declared exception to a desired Oracle number (Casteel, 2013, p. 149-150). For example:

Declare exception: ex_name_condition EXCEPTION;

Pragma statement: PRAGMA EXCEPTION_INIT(ex_name_condition, oracleNumber);

At this point, the exception portion of the PL/SQL block is executed when the Oracle error number is encountered.

A user defined exceptions allow developers to enforce business rules. These type of exceptions will not generate predefined exceptions or errors, so they must be developed to execute under certain circumstances (Casteel, 2013, p. 151-152). This is accomplished by declaring the exception, then executing the exception with the RAISE statement when a certain condition is met. For example:

Declare exception: ex_name_condition EXCEPTION;

IF condition THEN RAISE ex_name_condition;

At this point, the exception portion of the PL/SQL block executes the user defined statement or action.

References

Casteel, J. (2013). Oracle 11g: PL/SQL Programming. Boston, MA: Course Technology.

Q3. Respond to the following;

Cite References

Oracle provides some pre-defined exceptions which are names associated with some common errors that are encountered.

Non-predefined exceptions

If we receive an Oracle error that doesn't have a pre-defined exception we may need to create and exception for it and associate it with the Oracle error code. To do this we need to do the following:

DECLARE

Declare the exception name

Associate an Oracle error number with the exception name using the PRAGMA statement

BEGIN

Contains the error sequence

EXCEPTION

Exception handler runs if the sequence declared in BEGIN raises the error code contained in DECLARE

User-defined exceptions

A user-defined error is an error we manually create to handle what we perceive to be an error in the system. For example if no rows were updated after running some code. User defined errors are set up in the following format:

DECLARE

Declare the exception giving it a name

BEGIN

Contains the error sequence that we perceive as incorrect e.g if no rows are updated

EXCEPTION

Exception handler runs if the sequence declared in BEGIN raises the error code contained in DECLARE

Reference

Casteel, J. (2013). Oracle 11g: PL/SQL Programming, 2nd Edition. [VitalSource Bookshelf Online].

Q4. Answer the questions and be sure to cite work

What are the differences between anonymous PL/SQL code and procedures (Oracle named blocks)?

Reference no: EM131066620

Questions Cloud

Semi-annual interest payment : Record issuance of the bonds on June 30, 2016, the payment of interest at December 31, 2016, and the semi-annual interest payment on June 30 2017
The standard deviation for this sample group : A machine dispenses a liquid drug into bottles in such a way that the standard deviation of the contents is 81 milliliters. A new machine is tested on a sample of 24 containers and the standard deviation for this sample group is found to be 26 mil..
How they perceive the value of the training : You are interested in your employee's opinion of a training class. Specifically, you want to know if their experience level is a factor in how they perceive the value of the training. What are the null and alternate hypotheses?
How many sophomores are in the class : How many sophomores are in the class?
Steps in creating oracle non-predefined exception handlers : What are the differences between anonymous PL/SQL code and procedures (Oracle named blocks)? Explain the steps in creating Oracle non-predefined exception handlers and user defined exception handlers.
Airline claims that the no-show rate for passengers : An airline claims that the no-show rate for passengers is less than 5%. In a sample of 420 randomly selected reservations, 19 were no-shows. Use the z-test for proportions and test the airline's claim. Use a = 0.01. Solution:
Complete a rough draft for the market research : You are to complete a rough draft for the "Market Research" in the GE Project (from the syllabus). Additionally, in your post, please also discuss who your main competitor is and why.
Effects of the insecticide ddt on wild birds : Assume that an ecologist is studying the effects of the insecticide DDT on wild birds in Sumatra. DDT sprayed on insects and vegetation subsequently eaten by female birds seems to affect the thickness of their eggshells and thus affects the protec..
Amount of baldwin cash flow from assets : During the year, the firm issued $45,000 in net new equity and paid off $16,000 in long-term debt. What is the amount of Baldwin's cash flow from assets?

Reviews

Write a Review

Database Management System Questions & Answers

  Knowledge and data warehousing

Design a dimensional model for analysing Purchases for Adventure Works Cycles and implement it as cubes using SQL Server Analysis Services. The AdventureWorks OLTP sample database is the data source for you BI analysis.

  Design a database schema

Design a Database schema

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Prepare the e-r diagram for the movie database

Energy in the home, personal energy use and home energy efficiency and Efficient use of ‘waste' heat and renewable heat sources

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Prepare the relational schema for database

Prepare the relational schema for database

  Data modeling and normalization

Data Modeling and Normalization

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Knowledge and data warehousing

Knowledge and Data Warehousing

  Stack and queue data structure

Identify and explain the differences between a stack and a queue data structure

  Practice on topic of normalization

Practice on topic of Normalization

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd