Write an anonymous block that places a substitution variable

Assignment Help Basic Computer Science
Reference no: EM13309357

Please submit the CODE and OUTPUT for all programming questions. You will submit this assignment electronically in the ASSESSMENT area of the Study Desk.

In this assignment, you will use the CAR HIRE database. The CAR HIRE database including appropriate data will be made available on the USQ Oracle server. You can query these tables as if they are in your own schema but you are not permitted to insert or update data in these tables. The specification for the CAR HIRE database is as follows:

The table descriptions appear below, including the column names, data types and the meanings for values in the columns. Familiarise yourself with the tables and the data.

I_CAR

1286_CAR HIRE 1.png


I_CARGROUP

793_CAR HIRE 2.png


I_MODEL

305_CAR HIRE 3.png


I_CUSTOMER

1024_CAR HIRE 4.png


I_BOOKING

1674_CAR HIRE 5.png


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: EM13309357

Questions Cloud

State solutions act as buffers by placing a check in the box : Identify which of the following solutions may act as buffers by placing a check in the box next to the mixture. A. HNO3 , NaNO3 D. H2SO4, NaHSO4
Find where should the object be placed : An object with a height of 5cm is placed in front of a concave mirror that has a focal length of 12cm. where should the object be placed
Hopw to calculate the mass percentage of c and h : A 0.0989 g sample of an alcohol is burn in oxygen to yield 0.2160 g Co2 and 0.1194 g H2o. Calculate the mass percentage of C, H, and O in the compound
What is conservative force according to the text book : Explain the physics fundamental process that causes the scope ,rod, pith ball, etc to discharge when you touch it. what is conservative force according to the text book of Giancoli
Write an anonymous block that places a substitution variable : 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.
State a balanced hydrolysis equation to show why solutions : Write a balanced hydrolysis equation to show why solutions of aluminum chloride are acidic. (Hint; Al3+(aq) ions can be written Al(H2O)63+(aq).)
What was the initial temperature of the pan : A 750g aluminum pan is removed from the stove and plunged into a sink filled with 10.0kg of water at 20.0C. What was the initial temperature of the pan
Compute the theoretical wavelength in nanometers : Calculate the theoretical wavelength in nanometers of the light absorbed when an electron in a hydrogen atom makes a electron transition from level n=2 to n=7 (notated as "2==>7").
Determine the braking distance downhill and percent grade : Assuming that the coefficient of friction between the tires and the pavement is 0.30, determine the braking distance downhill and the percent grade of the highway at that section of the road.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Deduce closed-form expression-estimates-linear regression

In weighted least-squares linear regression, we have weight ri corresponding to each data measurement. Deduce closed-form expression for estimates of w and b which minimize objective function.

  Circuit that has 5 slide switches as inputs

Design and code a circuit that has 5 slide switches as inputs and a push-button. When the button is pressed, the circuit will drive a stepper motor n-steps in the clockwise direction

  Map elements can placed anywhere within body the web page

Map elements can be placed anywhere within the body of the Web page because they are not actually displayed by the browser, but used as references for mapping ____ to inline images.

  Create an applet to draw a digit using the method

Create an applet to draw a digit using the method fillRect of the class Graphics. For instance, if the input is 4, the applet will display the digit 4. In java language please

  Write program that will calculate square and cube of numbers

Write a program that will calculate square and cube of numbers ranging from 0 to 10. Print the output like the following table (hint: use for loop, to print as a table use printf formatting for width).

  Outside gridlines not affected table''s border true false

The outside gridlines are not affected by a table's border attribute; only the internal gridlines are changed. True False

  Explain security awareness and training document

Amy walked into her office cubicle and sat down. The entire episode with the blond man had taken well over two hours of her day. Based on this case study, what security awareness and training documents and posters had an impact in this event?

  Create a worksheet that computes membership costs

Create a worksheet that calculates membership costs for Buff and Tuff Gym. You will create functions that determine costs based on a condition, lookup membership rates and fees, and calculate monthly payments. You will also create functions that ..

  Draw the logic diagram for a circuit that resolves priority

Q:  "Draw the Logic diagram for a circuit that resolves priority among eight active-low inputs, 10_L-17_L, where 10_L has the highest priority.

  Creating flowchart of data found on employee time cards

Create a flowchart depicting the following situations: The data found on employee time cards are keyed onto a hard disk before they are processed by a computer.

  The initialization program

The initialization program will start with how much you have in the cash register and in what denominations the money is in.

  How would you show an input mask for a serial number

In MS Access, how would you show an input mask for a serial number that had 5 letters followed by 7 numbers? No dashes or any other characters.

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