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
Create a Oracle procedure to produce vertical output format when selecting rows from a database table.

Definition of FROM - SQL Recall that the operand of FROM is denoted by a commalist, each element of that commalist being a table expression optionally accompanied by a range v

Bulk Binds advantages In the Embedded Oracle RDBMS, the PL/SQL engines accept any valid PL/SQL subprogram or block. As the figure shows, the PL/SQL engine executes all procedur

At times, customers make mistakes in submitting their orders and call to cancel the order. Brewbean’s wants to create a trigger that automatically updates the stock level of all pr

Tautologies: Above given table allows us to read the truth of the connectives in the next manner. Just expect we are looking at row three. It means this says that, if there P

Using EXISTS The EXISTS(n) returns TRUE if the nth element in a collection exist. Or else, EXISTS(n) returns FALSE. Primarily, you use EXISTS with DELETE to maintain the spars

Advantages of PL/SQL The PL/SQL is a high-performance transaction processing, completely portable language that offers the following advantages as shown: 1) Support for SQL

Cursors The Oracle uses work areas to execute the SQL statements and to store process information. A PL/SQL construct known as the cursor. Let's you assume name a work area and

Project Description: I want a small relational database to be built. I want the database to have the subsequent information tables: Employee Information Document storage

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