Compare and contrast the basic while and for loops

Assignment Help C/C++ Programming
Reference no: EM131060094

Response must be 250 Words

Required APA Format

Q1. A new developer, who is new to PL/SQL, has just been hired to assist in your development group. Explain the differences between scalar, record and table variables to the new developer.

Response must be 150 Words

Required APA Format

Q2. PL/SQL includes three types of variable, including scalar, record, and table variables. All three of these serve a different purpose depending on how much data you want to store. For instance, if you want to only hold a singular value, a scalar variable should be assigned. Frequently, you only want to start something like the quantity of product number 4 in stock. A scalar variable is the most suitable for this value.
However, sometimes you may need to store multiple values of different datatypes, such as a table row. "A record can store and handle multiple values or fields, each having its own name and data type, as one unit." (Casteel, 2013). Records are appropriate for storing a single row of a database or a subset of columns from a row. Suppose you want to keep track of all of the books you own. One could use a record to grab the information about a book by a specific Title or ISBN and observe the fields of the record to gain addition information such as author, publisher, and date published.

Finally, you can think of table variables as array-types in traditional programming languages. Table variables are also known as collections and are ordered groups of elements having the same datatype. Just like an array, each element is represented by a unique subscript that represent the position in the collection (PL/SQL Collections, n.d.). These can be further subdivided into three types:

• Associative arrays - handles many rows of data, but one field

• Table of records - Similar to a record, but can hold multiple rows of data

• VARRAYS and Nested Tables - database columns that hold more than one value

References
Casteel, J. (2013). Oracle 11g: PL/SQL programming. Boston, MA: Course Technology, Cengage Learning.
PL/SQL collections.(n.d.). Retrieved from https://www.tutorialspoint.com/plsql/plsql_collections.htm

Response must be 150 Words

Required APA Format

Q3. I think you have all explained the scalar, record and table variables very well so I'll try not to repeat what has already been covered.
If a new developer started I would first out what programming languages they are already know and explain the variables using the language they are most familiar with. For example, If the developer was a C programmer I would tell them that scalars are the simple building block variables like int and char (Casteel, 2013, p.40)and that records are similar to structs in that you can group primitive variables into a logical unit. Finally, table variables or collections can be though of as an array. This could be an array of primitives such as int or could be an array of complex variables like struct's. There are a number of different types of collections in PL/SQL. I don't think there is a direct equivalent in plain old C to Associative Arrays but they work in Perl land they are called Hashes. Other collections in PL/SQL include Nested tables and VARRAY's. ("Composite Data Types",2006)

References

Casteel, J. (2013). Oracle 11g: PL/SQL Programming, 2nd Edition. [VitalSource Bookshelf Online].Retrieved on the 10th of May 2016 from https://cengagebrain.vitalsource.com/#/books/9781285531571/

Oracle Inc. (2006).Working with Composite Data Types. Retrieved on the 10th of May 2016 from https://www.macro.com.ar/PortalMacro/content/conn/macro/path/Contribution%20Folders/Revision/MacroEnLosMedios/PLLes06.pdf

Response must be 150 Words

Required APA Format

Q4. Scalar variables can hold a single value and common data types are VARCHAR2, CHAR, NUMBER, DATE, and BOOLEAN. Scalar variables allow to perform calculations and data manipulation tasks. However, composite variable can hold multiple values of scalar data type or composite data type. There are two types of composite data types:

1. PL/SQL records - when you want to store values of different data types but only one occurrence at a time.

A record is a group of related data items stored in fields, each with its own
name and data type. Each record defined can have as many fields as necessary and records can be assigned initial values and can be defined as NOT NULL. We can define RECORD types and declare user-defined records in the declarative part of any block, subprogram, or package. Also, we can declare and reference nested records. One record can be the component of another record.

2. PL/SQL collections - when you want to store values of the same data type.

Collections are of three types:
- INDEX BY tables or associative arrays
- Nested table
- VARRAY

Casteel, J. (2013). Oracle 11g: PL/SQL Programming. Boston, MA: Course Technology.
Oracle Database 10g: PL/SQL Fundamentals. (n.d.). Retrieved May 11, 2016, from https://www.macro.com.ar/PortalMacro/content/conn/macro/path/Contribution Folders/Revision/MacroEnLosMedios/PLLes06.pdf
The major decision structures in coding are loops. Compare and contrast the basic, WHILE, and FOR loops.

Response must be 150 Words

Required APA Format

Q5. The major decision structures in coding are loops. Compare and contrast the basic, WHILE, and FOR loops.

Response must be 150 Words

Required APA Format

Q6. A WHILE loop has a condition at the top of the LOOP in the LOOP clause to check. Each time the loop runs then that condition is checked and if that condition is TRUE then the loop continues. If on the other hand the condition is FALSE then the loop action stops.
A FOR loop on the other hand will only run for how many times it is directed to do so by a range in the statement. The following is an example of a FOR loop. i is 1 in the first iteration and for each loop it increase by 1 so once it reaches 5 the loop ends.

BEGIN
FOR i IN 1..5 LOOP
DBMS_OUTPUT.PUT_LINE(i);
END LOOP;
END;

Reference

Casteel, J. (2013). Oracle 11g: PL/SQL Programming. Boston, MA: Course Technology.

Reference no: EM131060094

Questions Cloud

Lecture notes to create a memorable conclusion : Using the information from this week's required readings, draft and post the conclusion to your research paper. While there is no set word limit for this assignment, your conclusion should provide adequate closure for your paper.
Determine the need for the new product or service : Formulate a feasibility analysis, and determine whether the new product or service is feasible. Identify the roadblocks that you will likely face.
Ghana highlife music culture including a short history : It needs to be MLA format and at least three hundred words. Paper needs to be on Ghana highlife music all work need be cited and include YouTube Link
Mechanical properties of sound : You perceive the sound of a siren to have a higher frequency when the ambulance is approaching you than when it is receding from you.  Which of the following statements about this observation is true?
Compare and contrast the basic while and for loops : A new developer, who is new to PL/SQL, has just been hired to assist in your development group. Explain the differences between scalar, record and table variables to the new developer.
How does it relate to a database administrator : What is a relational database management system and how does it relate to a database administrator?
Find the image distance when the object : Consider a concave mirror with a focal length of 15.54 cm. a) Find the image distance when the object distance is 15.54 cm. (Answer with -1000 if the image does not exist.) Answer in units of cm. b) Find the image distance when the object distance..
Calculate the magnification of the image : The image of a crayon appears to be 21.5 cm behind the surface of a convex mirror and is 2.39 cm tall. The mirror's focal length is 40.9 cm. a) How far in front of the mirror is the crayon positioned? Answer in units of cm.
Identify the data that should be incorporated into cgc : Identify the data that should be incorporated into CGC's new system to provide adequate planning capability.  Explain why each data item it is important and the level of detail needed for the data to be useful

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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