On occasion, some of Brewbean’s customers mistakenly leave an item out of a basket already checked out, therefore they create a new basket containing the missing items. Though they request that the baskets be combined and hence they are not charged extra shipping. The screen has been developed to permit an employee to modify the basket id of items in the BB_BASKETITEM table to another existing basket to merge the baskets. The block has been constructed to support this screen and can be found at the end of this question. Though an exception requires to be added to trap the condition in which an invalid basket id is entered for original basket. In this situation, the UPDATE affects no rows however does not raise an Oracle error. The handler must display a message stating “invalid original basket id”. Employ a host variable named G_OLD with a value of 30 and a host variable named G_NEW with a value of 4 to give the values to the block. First confirm 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;
/