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

  Program that evaluates a infix expression

Program that evaluates a infix expression using stacks terminated by an equal sign. for example: (4-2)-5)/(2+1)-2))=the expression will contain single digit and the operators +, -, *,/. Make sure to consider the operator precedence.

  Write a c program that asks for and reads in two integers

Write a C program that asks for and reads in two integers and then reports if one is a multiple of the other.

  Program that converts kilograms into pounds

Write a program that prompts the user to enter the weight of a person in kilograms and outputs the equivalent weight in pounds output both the weights rounded to two decimal places.

  The use of one learning pattern to another

1. A person who can feel themselves shifting from the use of one Learning Pattern to another is a(n)        Dynamic learner.        Bridge learner.

  Displays all the numbers

write a java program that displays all the numbers from 100 to 200, ten per line, that are divisible by 5 and 6 .

  Write a c matrix multiplication program which you can

write a c matrix multiplication program which you can instrument to monitor and measure execution time as a function of

  Make a c program that squares the number

Make a C program that accepts an integer value at the main method from the keyboard and in turn passes the value to a function that squares the number

  Prepare a program to get a number from the user

How will you prepare a program to get a number from the user and then demonstrate the output as the result above?

  Write a function that collects integers from the user

Write a function that collects integers from the user until a 0 is encountered and returns them in a list in the order they were input (ML only).

  Write a program to find the area of a circle

Write a program to find the area of a circle. The program should use two procedures. The first procedure will print out the program heading and ask the user to enter the radius.

  Design a modularized body mass index program

You are the nutritional coach for a local high school football team. You realize that some of the players are not up to par having returned from summer break. Realizing nutrition plays a key in a productive team, you decide to implement a Body Mas..

  Extension of a filename

Modify your earlier program that found the extension of a filename. This time your program will identify a file name that is no longer that 12 characters and has one of five extensions that you specify (eg: .doc. .py, .html, .txt, .ps).

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