Create and test two db2 procedures one that implements


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).

Request for Solution File

Ask an Expert for Answer!!
Database Management System: Create and test two db2 procedures one that implements
Reference No:- TGS02777415

Expected delivery within 24 Hours