All pastes #275553 Raw Edit

Someone

public text v1 · immutable
·published 2006-12-11 16:47 UTC
rendered paste body
Using the following categories and their percentages
Category: Percentage:
Computer 20
Cooking 15
Literature 10
Self-Help 10

Create a PL/SQL block that will calculate and update the retail price of a book in the books table.
The users must be allowed to enter the ISBN number of the book that needs to be updated.
The block of PL/SQL should determine the category of the book, and then the associated price increase percentage, thus, calculating the new retail price for the book. After your PL/SQL code updates the price of the book, the user should be notified of the title of the book that was just updated, and that the price has been updated (success).

declare
	v_title varcher2(30);
	v_category  varcher2(30);
	v_newPrice number(7,2);
Begin
	Select title, category
	Into v_title, v_category  
	From books
	If v_gategory = computer then v_newPrice := retail*0.20;
	elsif  v_gategory = cooking then  v_newPrice := retail*0.15;
	elsif  v_gategory = literature then v_newPrice := retail*0.10;
	elsif  v_gategory = Self-Help then  v_newPrice := retail*0.10;

End if;
DBMS_OUTPUT.PUTLINE
(v_title || v_newPrice);
End;
/