Write an anonymous block that places a substitution variable

Assignment Help Computer Engineering
Reference no: EM13337320

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)

Reference no: EM13337320

Questions Cloud

The universality of the portable document format : With the advent of scanners and the universality of the portable document format (PDF), the market for optical copiers is shrinking rapidly. Can a company such as Xerox Corporation survive?
Prepare the service revenue budget for 2012 : Prepare the service revenue budget for 2012 by listing the departments and showing for each quarter and the year in total, billable hours, billable rate, and total revenue
Find at what rate is the spring doing work on the mass : The mass has a kinetic energy of 17.0 J as it passes through its equilibrium position (the point at which the spring force is zero). At what rate is the spring doing work on the mass
What is the total force the person must apply : A person is pushing a uniformly-loaded 24.15 kg wheelbarrow along a plank that makes an angle ? = 38.0° with the horizontal. What is the total force the person must apply
Write an anonymous block that places a substitution variable : 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.
Find the magnitude of the total acceleration : A race car accelerates uniformly from a speed of 39.0 m/s to a speed of 64.0 m/s in 5.00 s while traveling clockwise around a circular track of radius 4.40 102 m. Find the magnitude of the total acceleration when the speed is 40.0 m/s
What is the magnitude of the larger of the two resistances : When a 45.0-V emf device is placed across two resistors in series, a current of 15.0 A is flowing in each of the resistors. When the same emf device is placed across the same two resistors in parallel,
How do two tables are true relationship tables : Howw do two tables are 'True relationship tables'
What are the total costs and total variable costs : Gizmos, Inc. produces gizmos at an average total cost (ATC) of $20 and an average variable cost (AVC) of $15. The only fixed input used in the production of gizmos costs $20. What are the total costs (TC) and total variable costs (TVC) of Gizmo’s cur..

Reviews

Write a Review

Computer Engineering Questions & Answers

  How can translate into the broader area of business ethics

What responsibility do computing professionals have to society at large and to other members in their profession.how can translate into the broader area of business ethics.

  Characterize the company''s personnel as its human asset

Why do we characterize the company's personnel as its human asset? Explain and exemplify.

  Program that continuously outputs random numbers

Write down a code in Java that continuously outputs random numbers between 0 and 10000 until a number which is divisible by 5 is encountered.

  How many bits will be the network prefix in each address

You talk to a colleague and she tells you that her company just bought 10.16.0.0/12 addresses at a price that is significantly lower than what your ISPs are charging you. Does this sound like a good deal to you? If so, why?

  Reconnaissance tools

Enlist some of the popular reconnaissance tools, comparing three of the reconnaissance tools describing the advantages.

  Exemplify the predisposition towards web development

PHP and ASP are both well suited for web development. What are some of the features and capabilities that exemplify this predisposition towards web development? Are there any implementations for running client-side PHP.

  Write a function that reads integers from the keyboard

Write a function that reads integers from the keyboard. If any of the numbers are negative, it returns number. If all the numbers are postive, it returns their average.

  Find all of the substrings that form numbers

Given a string of numbers, identify all of substrings that form numbers that are divisible by 3. For instance, applying the algorithm on the string 37540 should produce the following substrings (not necessarily in this order): 0; 3; 75; 54; 375; 5..

  Modify a program three numbers representing temperature

Write down a program that accepts three numbers representing temperature, relative humidity, and wind speed; assigns the value true or false to the boolean variable okToSpray according to these criteria; and displays this value.

  Assume a direct access file consists of sectors

assume a direct access file consists of sectors with 1024 byte capacity. Suppose also that records are 32 bytes long. On which logical sector do the following logical records lie? What is the relative record number in the sector?

  Illustrate the architecture of the oracle instance

The Oracle Instance and Transaction/Query Processing (a) Illustrate the architecture of the Oracle instance, including all memory structures, processes, and associated physical files.

  The algorithms of the parallel and perspective projection

I have a java application that reads in a vertex list and face list. I also have code to write 2-D lines and ouput that image file. In my code I have the standard 3D default values defined for: PRP and VRP reference points, VPN and VUP vectors, an..

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