Programming PL/SQL Objects
Declaring PL/SQL Variables
Writing Control Structures
Using Explicit Cursors
Create a basic PL/SQL block- Exercise
Operators in PL/SQL
Course project: Create a basic PL/SQL block
Create a basic PL/SQL block that uses identifiers, literals, operators, and conversion functions.
This exercise is worth a total of 30 points. You will receive up to 20 points for submitting the correct code to build the PL/SQL block. You will receive up to 5 points for documenting your code. You will receive up to 5 points for explaining whether the use of nested block is justified in this case.
House-O-Pets has hired you for your PL/SQL skills. Before the store can sell pets online, it requires your immediate assistance to build a PL/SQL block that will calculate the price of a pet.
House-O-Pets also has some junior developers who have been discussing whether to use a nested block. You need to guide them regarding whether the use of a nested block is justified here.
The net price of a pet is calculated by adding the price of the pet and the state tax. Both these values are passed to the PL/SQL block through SQL*Plus substitution variables. For this exercise, do the following:
Convert the state tax from a whole number to a decimal (for example, 5 to .5).
Explain whether the use of a nested block is justified in this case.
ACCEPT with PROMPT
SQL*Plus command to accept values from the user. Display the net price of the pet using
Submitting your exercise
Enter your PL/SQL block into the text box below. Click the
button to submit your answer.