RelationalDBDesign
Technology
Search
SiteMap
RedhatLinuxSys
Seomining
Advanced Oracle Tuning
Advanced SQL
Backup Recovery Options
Basic SQL
DB Admin Features
DB Creation Architecture
Extended DB Features
Managing DB Objects
Managing Connectivity
Network Configuration
Oracle BU Features
Oracle DB Recovery
Network Administration
Oracle Network Topology
Oracle SQL Extensions
Oracle SQL Tuning
8i PL/SQL Programming
Performance Tuning
PL/SQL Stored Objects
PL/SQL Programming
Relational DB Analysis
Relational DB Design
Tech Interview Questions
Tuning Oracle Instance
Programming PL/SQL Objects
Declaring PL/SQL Variables
PL/SQL Datatypes
Writing Control Structures
Composite Datatypes
Create a basic PL/SQL block- Exercise
Operators in PL/SQL
Course project: Create a basic PL/SQL block
Objective:
Create a basic PL/SQL block that uses identifiers, literals, operators, and conversion functions.
Exercise scoring
This exercise is worth a total of 30 points. You'll receive up to 20 points for submitting the correct code to build the PL/SQL block. You'll receive up to 5 points for documenting your code. Youll receive up to 5 points for explaining whether the use of nested block is justified in this case.
Background/overview
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.
Instructions
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.
Exercise Hints
Use the
ACCEPT with PROMPT
SQL*Plus command to accept values from the user. Display the net price of the pet using
DBMS_OUTPUT.PUT_LINE (string_value)
.
Submitting your exercise
Enter your PL/SQL block into the text box below. Click the
Submit
button to submit your answer.