Case 1: Using Variable Types The Brewbeans\' manager has just hired another prog
ID: 3907674 • Letter: C
Question
Case 1: Using Variable Types
The Brewbeans' manager has just hired another programmer to help you develop application code for the online store. The manager has asked you to develop an applicable explanation for the difference between scalar, record and table variables to the new employee. Submit your applicable explanation with at least one credible in-text citations and reference list.
Case 2: Working with More Movie Rentals
The More Movie Rental Company is developing an application page that displays the total number of times a specified movie has been rented and the associated rental rating based on this count. The table shows the rental ratings.
Movie Rental Ratings
Number of Rentals
Rental Rating
Up to 5
Dump
5-20
Low
21-35
Mid
More than 35
High
Create a block that retrieves the movie title and rental count based on a movie ID provided via an initialized variable. The block should display the movie title, rental count and rental rating onscreen. Add exception handlers for errors you can and cannot anticipate. Run the block with movie IDs of 4 and 25.
Number of Rentals
Rental Rating
Up to 5
Dump
5-20
Low
21-35
Mid
More than 35
High
Explanation / Answer
Answer:
Case 1: Using variable types
Difference amomg scalar, record and table types can be explained as below:
Scalar: Scalar variable type store single values with no internal components. A scalar can have values of numeric, boolean, character, datetime or interval types.
Record: A record variable type can store and handle multiple values or fields, each having its own name and data type, as one unit. In other words, it is like representing a row of a table.
Table: A table variable type represents a collection (of records). It can handle many record (rows) or many columns of data. It is like a table structure in database.
Case 2: Working with movie more rentals
See the block below:
--------------------------------------------
DECLARE
MTITLE MOVIE_RENTALS.MOVIE_TITLE%TYPE;
RCOUNT MOVIE_RENTALS.RENTAL_COUNT%TYPE;
MOVIE_ID NUMBER := 4;
RENTAL_RATING CHARACTER :='';
BEGIN
SELECT MOVIE_TITLE,RENTAL_COUNT
INTO MTITLE,RCOUNT
FROM MOVIE_RENTALS
WHERE MOVIE_RENTALS.MOVIE_ID = MOVIE_ID;
IF RCOUNT < 5 THEN
RENTAL_RATING := 'DUMP';
ELSE IF RCOUNT >= 5 AND RCOUNT < 20 THEN
RENTAL_RATING := 'LOW';
ELSE IF RCOUNT >= 21 AND RCOUNT > 35 THEN
RENTAL_RATING := 'MID';
ELSE IF RCOUNT > 35 THEN
RENTAL_RATING := 'HIGH'
END IF
DBMS_OUTPUT.PUT_LINE('TITLE: ' || MTITLE || 'RENTAL COUNT: ' || RCOUNT || 'RENTAL RATING: ' || RENTAL_RATING);
END;
---------------------------------------------
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.