Perform exception handling with user-defined errors, PL-SQL Programming

On occasion, some of Brewbean's customers mistakenly leave an item out of a basket already checked out, so they create a new basket containing the missing items. However, they request that the baskets be combined so that they are not charged extra shipping.  A screen has been developed to allow an employee to modify the basket id of items in the BB_BASKETITEM table to another to another existing basket to combine the baskets. A block has been constructed to support this screen and can be found at the end of this question. However, an exception needs to be added to trap the situation in which an invalid basket id is entered for the original basket. In this case, the UPDATE affects no rows but does not raise an Oracle error. The handler should display a message stating "invalid original basket id". Use a host variable named G_OLD with a value of 30 and a host variable named G_NEW with a value of 4 to provide the values to the block. First verify that no item rows exist in the BB_BASKETITEM table with a basket id of 30.

BEGIN
  UPDATE bb_basketitem
   SET idBasket = :g_new
   WHERE idBasket = :g_old;
END;
/

Posted Date: 3/12/2013 2:04:23 AM | Location : United States







Related Discussions:- Perform exception handling with user-defined errors, Assignment Help, Ask Question on Perform exception handling with user-defined errors, Get Answer, Expert's Help, Perform exception handling with user-defined errors Discussions

Write discussion on Perform exception handling with user-defined errors
Your posts are moderated
Related Questions
Parameter and Keyword Description: dynamic_string: This is a string variable, literal, or expression which represents a SQL statement or the PL/SQL block. define_vari

1. a. Write a trigger that fires when a part's price is updated. The trigger will write a record into a table called PriceUpdates. The record should contain the information of

COSMOZOI C THEORY - Richter (1865) proposed the cosmozoic theory that says that life came by spores (cosmozoa) or other particles from other planets on the earth.

Inserting Objects: You can use the INSERT statement to add objects to an object table. In the illustration below, you insert a Person object into the object table persons:

V ariables and Constants in PL/SQL The PL/SQL permits you to declare constants and variables, and then use them in SQL and procedural statements anywhere in the expression. Th

Data Types in SQL - Timestamp TIMESTAMP for values representing points in time on a specified uniform scale. DATE is used for timestamps on a scale of one day, such as DATE '2

Package Specification The package specifications contain the public declarations. The scopes of these declarations are local to your database representation and global to the

Using Operator DEREF: You cannot navigate through refs within the PL/SQL procedural statements. Rather than, you should use the operator DEREF in the SQL statement. The DEREF

Example of ADD CONSTRAINT in SQL Example: Alternative formulation for MAX_ENROLMENTS ALTER TABLE IS_ENROLLED_ON ADD CONSTRAINT MAX_ENROLMENTS CHECK ((SELECT COUNT (*)

Creating and Destroying Base Tables: Example shows an SQL command to create the base table counterpart of the ENROLMENT variable Example  Creating a base table. CREATE T