Create a local variable that inherits the structure

Assignment Help Programming Languages
Reference no: EM13761387

Question 1

Write an anonymous block that places a substitution variable (&) into a local variable of type character. You should check the value entered in the local variable and output different messages depending on the value provided.

• If value is ‘A', output: ‘Please proceed to Level 1'

• If value is ‘B' or ‘C', output: ‘Please proceed to Level 2'

• If value is ‘D', output: ‘Please proceed to Level 3'

• In all other entries, output: ‘Invalid Entry'

Question 2

Create a host (or global) variable named G_NEWVALUE.

Write an anonymous block that declares two local variables: A1RATE and B2RATE. The data types of these two variables should be the same as the data type of the column rate_per_mile in i_cargroup table. Also declare a constant called SURCHARGE with value 5.

In your BEGIN section, write two SELECT queries to obtain value of the rate_per_mile column where car_group_name is ‘A1' and ‘B2' and assign the corresponding values to A1RATE and B2RATE variables. Now use the IF-THEN statement to compare the two variables and add the constant SURCHARGE to the smaller value. Assign the new sum to the variable G_NEWVALUE.

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

Question 3

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, cost and the number of bookings for each car.

Question 4

Write a PL/SQL that displays the maximum miles driven from the odometer reading for all the car bookings. Your program must use at least one explicit cursor and must NOT use any functions, for example SUM, MAX, COUNT, etc.

(Hint: miles driven from the odometer reading for each booking can be found by subtracting miles_out column from miles_in column, i.e. miles_in - miles_out)

MARKING CRITERIA

1. The code executes without error messages.

2. The code produces the required output.

3. The code addresses the specification and provides a solution to every element in the specification.

4. The code is well structured and, where applicable, adopts an optimal and sophisticated approach to PL/SQL.

Reference no: EM13761387

Questions Cloud

What are the economic implications of action : Assume that the government imposed a price ceiling on gasoline in order to prevent prices from getting too high. What are the economic implications of action in the gasoline markets? Use graphs as needed and explain your answers thoroughly.
Develop and verify a back up plan to complete your work : In our discussion for this week you will develop and verify a back up plan to complete your work. Where will you go to get access to another computer to do your work when you lose power in your neighborhood
Explain how you would use the monetary and fiscal policy : Write a three- page research to explain how you would use the monetary and fiscal policy tools to jump start the economy.
Differences between white hat and gray hat hackers : Research the art and science of ethical hacking. Provide a plain English summary of your research in which you answer the following: What are the primary differences between white hat and gray hat hackers? Is it possible for hacking to be conducted ..
Create a local variable that inherits the structure : Create a local variable that inherits the structure of the i_car table (using %ROWTYPE attribute). Place each row returned into this variable.
Develop an organizational structure for the product : Develop an organizational structure for the product and create an operations plan
Describe at least three purposes of the budgetary process : 1. Describe at least three purposes of the budgetary process. 2. For a company's budget to have a positive effect on their employees, describe three guidelines for the budgeting process.
Advantages and disadvantages of using your proposed tool : You are the new network administrator for a small hospital in your local city. Discuss the advantages and disadvantages of using your proposed tool
Provide an example of a dmz : Your senior network architect suddenly left the company that you work for, and you are left alone with your manager and 3 help desk support staff who you are not too familiar with the network operation of the organization

Reviews

Write a Review

Programming Languages Questions & Answers

  Explain inheritance structures of galaga

Write a 3-page paper about inheritance structures of Galaga. Recognize the parent and child classes and describe what each class has for events and data.

  Calculate interest on account balance-get total amount due

Accepts account balance and calculates interest on Account balance. It then adds on interest to get total amount due.

  Create a webpage that will accept students grades

Create a webpage that will accept students' grades and produce statistic results -

  Explain how is recursion and iteration used in programming

question 1 how is recursion and iteration used in programming? provide examples of the various types of recursion and

  Write attribute grammar using only synthesized attributes

Semantics of this string literal is correct if numeric value of baseten numeral matches length of string. Write attribute grammar using only synthesized attributes for nonterminals in definition of

  Create a macro that multiplies

Create a macro named mMult32 that multiplies two unsigned 32-bit memory operands and produces a 32-bit product.

  Calculating hit ratio for program having loops

Calculate hit ratio for program that loops 10 times from locations 0 - 64.

  Write program that compute the amount person earn

Write a program which computes the amount a person would earn over period of time if his or her salary is one penny the first day, two pennies second day.

  Design logic that continuously prompt user for numeric value

Design the logic for a program that continuously prompts a user for a numeric value until the user enters 0. The application passes the value in turn to a method that squares the number

  Design program that stores information of products

You are asked to design a program that stores information of given products. Your program must be menu driven. The program menu must include the following options: Add product information (Ask user to input product id, name and price)

  Write program to accept specific team criteria

Here is the initial list of functional requirements: The program should be able to: Accept specific team criteria, Accept specific player criteria,Match players to teams based on criteria specified.

  Design application that would output payment coupons

Design the application that would output 12 payment coupons for each of the 15 apartments in each of the 20 buildings. Each coupon should contain the building number.

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