Oracle 11g PLSQL Programming The Brewbeans application conta
Oracle 11g PL/SQL Programming
The Brewbean’s application contains a page displaying order summary information, including
IDBASKET, SUBTOTAL, SHIPPING, TAX, and TOTAL columns from the BB_BASKET
table. Create a PL/SQL block with a record variable to retrieve this data and display it
onscreen. An initialized variable should provide the IDBASKET value. Test the block using
the basket ID 12.
Solution
variable idbasket number begin :basket2 := 12; end; / declare basket bb_basket.idbasket%TYPE; sub bb_basket.subtotal%TYPE; ship bb_basket.shipping%TYPE; tax bb_basket.tax%TYPE; total bb_basket.total%TYPE; begin select idbasket, subtotal, shipping, tax, total into basket, sub, ship, tax, total from bb_basket where idbasket = :basket2; dbms_output.put_line(\'Basket \' || basket || \' has a subtotal of\' || to_char(sub, \'$99.99\') || \', shipping is\' || to_char(ship, \'$99.99\') || \',\' || chr(10) || \' tax is\' || to_char(tax, \'$99.99\') || \', and the total is\' || to_char(total, \'$99.99\')); end;