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
Packaging Cursors   You can split a cursor specification from its body for placement in a package. In that way, you can change the cursor body without changing the cursor spec

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.

heap sort program in pl/sql

Parameter and Keyword Description: type_name: This identifies a user-defined type specifier that is used in the subsequent declarations of the objects. AUTHID Clause:

WHILE-LOOP The WHILE-LOOP statement relates a condition with the series of statements enclosed by the keywords LOOP and END LOOP, as shown: WHILE condition LOOP sequence_of_sta

which operation is used if we are interested in only certain columns of a table?

OUT Mode An OUT parameter returns values to the caller of a subprogram. Within the subprogram, an OUT parameter act like a variable. That means that you can use an OUT formal

Tables within a Table - SQL Figure here is an exact copy of the one in the theory book and as before it is just an alternative way of representing some of the information con

Example of Table Literal - SQL Example: A Table Literal (correct version) VALUES ('S1', 'C1', 'Anne'), ('S1', 'C2', 'Anne'), ('S2', 'C1', 'Boris'), ('S3', 'C3'

DBMS_OUTPUT: The Package DBMS_OUTPUT enables you to display output from the PL/SQL subprograms and blocks, that makes it easier to test and debug them. The procedure put_ line