Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask DBMS Expert


Home >> DBMS

Assignment

You have been asked to create and test two DB2 procedures: one that implements basic arithmetic operations, and another that retrieves data from a specific table. You will develop a version of each procedure for both the Power Systems and System-z environments.

Upon the completion of this lab, students will have hands-on experience coding SQL PL Procedures in DB2 on multiple platforms.

Deliverables:

Lab Steps

Step 1 DB2 SQL PL Basic Arithmetic Procedure in Power Systems.
Step 2 DB2 SQL PL Basic Arithmetic Procedure in System z.
Step 3 Retrieving data from Student Registration Database in Power Systems.
Step 4 Retrieving data from Student Registration Database in System z.

You should submit to the Dropbox a Word document containing:

SQL PL code for each task

Screenshots of the output from each task (Each screenshot immediately follows the associated code).

iLab Steps

Step 1: SQL PL Basic Arithmetic Procedure

Code a PL/SQL script that will output three variables containing messages. To produce these messages, your procedure should initialize three variables with the values 45, 72, and 6.3. These values will be used to create messages as follows.

The first message will report the result of adding the first two numbers (45 and 72) and then multiplying their sum by the third number (6.3). Format the message as:

The result of (first_num + second_num) * third_num equals tot_val.

An example message, formed using different numbers but following the same approach, would look like this:

The result of (2 + 3) * 4 equals 20

The second message will be constructed in a similar manner, except that now the first number (45) is added to the product of the last two numbers (72 and 6.3). Format the second message as:

The result of first_num + second_num * third_num equals tot_val.

An example message, formed using different numbers but following the same approach, would look like this:

The result of 2 + 3 * 4 equals 14.

The third message should state:

The difference is due to the "Order of Operations."

Sample output:
Lab01_Tsk01 Output:
The result of (2 + 3) * 4 equals 20
The result of 2 + 3 * 4 equals 14
The difference is due to the "Order of Operations."
The result of 2+3*4 equals 14
The difference is due to the "Order of Precedence".
Step 2: Retrieving data from Student Registration Database

This requires use of the Student Registration Database and the columns in the Student Table.

Code a SQL PL procedure that will accept a student id as an input parameter and then retrieve the student's first name, last name, employer, and phone number. This information will be packaged into a message that gets returned from the procedure as an output parameter. The message will be formatted as follows:

[first_name] [last_name] works at [employer] and can be reached at [phone].

For example:

Joe Blowe works at FedEx and can be reached at (773) 555-1212.
However, if the student id entered cannot be found in the table, your output message should be as follows::
The student id n does not exist.

For example:

The student id, 999, does not exist.

Execute the script four times, using the following values: 130, 200, 310, and 909. The last value should result in the message stating that the student id does not exist. (This is a function of the data in the Student table - do not hard-code any specific values in your procedure).

DBMS, Programming

  • Category:- DBMS
  • Reference No.:- M92820599

Have any Question?


Related Questions in DBMS

Quesiton 1 what is data-manipulation language dml there are

Quesiton: 1. What is Data-Manipulation Language (DML)? There are four types of access in DML, explain each one. 2. Assume we have a Library Database consists of the following relations: author(author_id, first_name, last ...

Assignment question - write and run sql statements to

Assignment Question - Write and run SQL statements to complete the following tasks Part A - DML 1. Locate the record in the vendor table that does not have a value for the attribute V_STATE 2. Find the customers whose ba ...

Suppose that we have a table of house prices and a table of

Suppose that we have a table of house prices and a table of zip codes: • hprices(hid (PK),address,bedrooms,price,zipcode) • zipcodes(zipcode (PK),state) Write a SQL query that finds the average, maximum, and minimum pric ...

Question find at least two academic sources that describe

Question: Find at least two academic sources that describe the movement of Enterprise resource planning (ERP) activities to the cloud. Discuss the types of ERP activities that can be conducted in the cloud and the pros a ...

Suppose that you have designed a database for morgan

Suppose that you have designed a database for Morgan Importing that has the following tables: EMPLOYEE (EmployeeID, LastName, FirstName, Department, Phone, Fax, EmailAddress) STORE (StoreName, City, Country, Phone, Fax, ...

Sqlquery 1 how many products have standard price less than

SQL Query 1. How many products have standard price less than 1000? Query 2: Display all attributes for products made of "Cherry" from Product table w/o referring to column names. Query 3: Display all product names having ...

Systems analysis project scenic routes operates a bus

Systems analysis project Scenic Routes operates a bus company that specializes in travelling on secondary roads, rather than Interstate highways. Their slogan is: "It Takes a Little Longer, But It's Scenic." The firm nee ...

Project outline and requirements provide a brief

Project Outline and Requirements Provide a brief description of the organization (can be hypothetical) that will be used as the basis for the projects in the course. Include company size, location(s), and other pertinent ...

Instructionsfor decades relational databases remained

Instructions For decades, relational databases remained essentially unchanged; data was segmented into specific chunks for columns, slots, and repositories, also called structured data. However, in this Internet of Thing ...

We can represent a data set as a collection of object nodes

We can represent a data set as a collection of object nodes and a collection of attribute nodes, where there is a link between each object and each attribute, and where the weight of that link is the value of the object ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As