Write a pl/sql solution that displays the registration

Assignment Help PL-SQL Programming
Reference no: EM13764264

Q1- Write an anonymous block that places a substitution variable (&) into a local variable of type varchar2. You will need to convert the types and round them to nearest tens unit. For example 84.4555 would be 84.5. You should check the value entered in the local variable and output different messages depending on the value provided. The anonymous block is a simple grade calculator with the following rules.

If value less than 44.5 output the following message "Resulting Grade for VALUE marks is ‘F'"
If value is between 44.5 and 49.4 output the following message "Resulting Grade for VALUE marks is ‘IS'"
If value is between 49.5 and 64.4 output the following message "Resulting Grade for VALUE marks is ‘C'"
If value between 64.5 and 74.4 output the following message "Resulting Grade for VALUE marks is ‘B'"
If value is between 74.5 and 84.4 output the following message "Resulting Grade for VALUE marks is ‘A'"
If value is between 84.5 and 100 output the following message "Resulting Grade for VALUE marks is ‘HD'"
If the value does not fall in the range of 0 - 100 print an error message "ONLY MARKS BETWEEN 0 AND 100 ACCEPTED)"

Note: The ‘VALUE' in the message is to be replaced by the value of the substitution local variable value.

Single quotes are required around the grade results.

Q2- Write an anonymous block that meets the following specification:

1. Using an explicit cursor, retrieve each row from the i_car table.
2. Create a local variable that inherits the structure of the i_car table (using %ROWTYPE attribute). Place each row returned into this variable.
3. Using an implicit cursor, calculate the number of bookings that belong to each car.
4. Display the car registration, car group name, model name and the number of bookings for all the cars that have two or more bookings.
5. If the car has no bookings sum up the number of cars without bookings.
6. At the end of the run display a message "There are VALUE cars that have no bookings recorded".

Note: The VALUE is to be replaced with the total number of cars found during the process without bookings. The VALUE needs to be calculates during the explicit cursor execution.

You can only use one COUNT( ) statement for your solution in the body of the anonymous block.

Q3- Create a bound/host (or global) variable named G_NEWCOST.

Write an anonymous block that declares two local variables: A3_COST and B3_COST. The data types of these two variables should be the same as the data type of the column cost in i_car table. Also declare a constant called DEPRECIATION with value 15.25 to be used for deprecation calculation.

In your BEGIN section, write two SELECT queries to obtain value of the cost column where car_group_name is ‘A3' and ‘B3' and assign the corresponding values to A3_COST and B3_COST variables.

Now use the IF-THEN statement to compare the two variables to find out which one has a highest value. Calculate the new cost by using constant DEPRECIATION to calculate the new value total cost * ((100 - DEPRICATION)/100) to the higher value and assign the new value to bound/host variable G_NEWCOST.

Display a message in the following format from your code block: "The car group CARGROUP has total cost of $TOTALCOST.XX and has been depreciated to $G_NEWCOST.XX"

The CARGROUP should display the highest car group (A3 or B3 depending on values).
The TOTALCOST will be the total calculated in the SELECT query statement.
G_NEWCOST will be the derived value after decreasing the cost with the DEPRECIATION value. Format the G_NEWCOST value to 2 decimal places.
The XX represent the decimal places in the format.

Using the PRINT command, output the value in the host variable (G_NEWCOST) after the anonymous block has run.

Q4- Write a PL/SQL solution that displays the registration and the maximum and the minimum miles travelled by a car during the rental period for all the bookings where the booking has been paid for.

The output from the anonymous block will be two messages. One message will display the information for the maximum miles driven and one for the minimum miles driven in the following format.

"The maximum miles driven was MAXIMUM by car REGISTRATION over DAYS day's"
"The minimum miles driven was MINIMUM by car REGISTRATION over DAYS day's"
Where MAXIMUM is the maximum miles calculated from the bookings table.
MINIMUM is the minimum miles calculated in the bookings table.
DAYS is the rental_period for the maximum and minimum miles travelled in the booking table.

Your program must use at least one explicit cursor and must NOT use any aggregate functions, for example SUM, MAX, COUNT, etc.

(Hint: miles driven for each booking will need to be calculated. Only the bookings where the booking has been paid for should be processed.

All the information for the program is located in the i_booking table)

Reference no: EM13764264

Questions Cloud

Explain character conflict in a temporary matter by jhumpa : Explain character conflict in A Temporary Matter by Jhumpa Lahiri. please consider each story's conflicts in light of contemporary societal issues.
Categorize the debts and determine the order : Bob files for bankruptcy with the following assets and debts. Categorize the debts and determine the order and manner in which they will be resolved
Issues related to weathering and erosion : Weathering and erosion are very closely related topics. Describe how these two processes can shape the landscape and be sure to provide examples.
Does it predict the actual outcome well : Does it predict the actual outcome well or Does it fail? If so, why? Lastly, express your opinion. Is there something policy makers can do to improve welfare? How?
Write a pl/sql solution that displays the registration : Write a PL/SQL solution that displays the registration and the maximum and the minimum miles travelled by a car during the rental period for all the bookings where the booking has been paid for.
Explain character conflict in floating bridge by alice munro : Explain character conflict in story Floating Bridge by Alice Munro. For your initial post, please consider each story's conflicts in light of contemporary societal issues.
Phytosterols- nutrition related problems : Use a scientific journal article that describes the effects of foods containing phytosterols. Are there any health benefits of increasing the amount of phytosterols in your diet?
Introduction to network channels-processors and media : OSI Model, Switching Systems, Network Channel Processors, and Media
Manufacturing budget analysis : Tom Emory and Jim Morris strolled back to their plant from the administrative offices of Ferguson & Son Manufacturing Company. Tom is manager of the machine shop in the company's factory; Jim is manager of the equipment maintenance department.

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  An er diagram for the system

An ER diagram for the system. Show all entities, relationships, cardinalities and optionalities. Also, include all intersection entities. You must use the Finkelstein methodology as per the study book and tutorials.

  Prepare sql queries to find the customers

Prepare SQL queries to find the customers who have reserved only 4-door cars.

  Update stock levels when the order is cancelled

Execute queries to confirm that the basket order status and product stock levels have been appropriately modified by the trigger - the trigger needs to fire when a new status record is added to the BB_BASKETSTATUS table and when the IDSTAGE col..

  A critical analysis of the available literature

Given the time scale and the need to obtain ethical approval for primary research, you are required to undertake secondary research only i.e. research using data from other sources.

  Display account number and balance for all customers

This assessment item is designed to test your understanding of arrays/arraylists, objects, classes, methods, sorting and searching.

  Write a select statement that returns four columns

Write a SELECT statement that returns four columns from the Products table: ProductCode, ProductName, ListPrice, and DiscountPercent. Then, run this statement to make sure it works correctly.

  Describe concepts of database-orientated programming

describe concepts of database-orientated programming language plsql as well as of data analysis techniques for

  Write a select statement that returns these columns

Write a SELECT statement that returns these columns from the Products table: The date_added column A column that uses the CAST function to return the date_added column with its date only (year, month, and day)

  Identify the choice that best completes the statement

Based upon the contents of the BOOKS table, which of the following SQL statements will display the retail price for two copies of each book currently in inventory?

  Write an sql statement to produce a single column called

write an sql statement to produce a single column called itemlocation that combines the skudescriptionthe phrase is

  Describe all system privileges found in sql server

Describe all system privileges found in SQL Server

  Convert the er/eer model

To represent a problem description given in natural language as an (Enhanced) Entity -Relationship model; to convert the ER/EER model into a relational data model;

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd