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
Find the account numbers of all customers whose balance is more than 10,000 $

GOTO Statement The GOTO statement branches to a label unconditionally. The label must be exclusive within its scope and should precede an executable statement or a PL/SQL block.

Using Operator VALUE: As you may expect, the operator VALUE returns the value of an object. The VALUE takes its argument a correlation variable.  For illustration, to return a

Using Aliases The Select-list items fetched from a cursor related with the %ROWTYPE should have simple names or, if they are expressions, should have aliases. In the example bel

Role of Abstraction in pl/sql: The abstraction is a high-level description or model of a real-world entity. The Abstractions keep our daily lives convenient. They help us ca

How Transactions Guard Your Database The transaction is a sequence of SQL data manipulation statements which does a logical unit of work. The Oracle treats the sequence of SQL

Selecting Objects: Suppose that you have run the SQL*Plus script below that creates object type Person and object table persons, and that you have settled the table: CREATE

Develop Data Business Intelligence Project Project Description: We are linking our Microsoft SQL Database to GoodData Business Intelligence. We are seeking somebody who has e

%TYPE: This attribute gives the datatype of a formerly declared collection, cursor variable, object, field, record, database column, or variable. Datatype: This is simply

Keys in SQL SQL support for keys in the following respects: SQL does not require at least one key for every base table. If no key is explicitly declared, then KEY {ALL B