Question: Write a PL/SQL program that will print your name in the format below. Declare variables for your first name, last name, and middle initial. The


Write a PL/SQL program that will print your name in the format below. Declare variables for your first name, last name, and middle initial. The first and last names should have a data type of varchar2(20). Your middle initial should have a data type of char(1). Assign values to the variables in the body of the program. If you don't have a middle initial, make one up. Sally K. Smith Your company has an employee named Sally Smith who is earning a salary of $53,821.56. Declare variables for the employee's first name, last name, and salary. The name variables should be of data type char(20) and the salary variable should have a precision of six digits before the decimal and two digits after. Assign values to all variables in the DECLARE section of the program. Print the report shown below replacing the x 's with actual values. Be sure you format both the name and salaries as shown. Sally Smith's Salary is $xx,xx,x 3. Sally Smith was born on November 10, 1983. Write the PL/SQL code that will (3) print the report below. You must declare at least two variables, one for the name and one for the birth date. The data type for the name should be char(20) and the data type for the birth date should be date. You might want to declare some other variables. Format the dates in PL/SQL as MM/DD/YYYY. (Hint: consider using the ADD_MONTHS function to determine her next birthday.) Sally was born on day of week Month Day, Year in 4 places. She is xx years old. Her Birthday is in xxx days. 4. Create a variable named current_date as a Timestamp and assign it the value (4) of SYSDATE. Declare a variable called HOUR as a Char(2) and a variable called MINUTE as Char(2). In the body of the program, assign the value of HOUR to the Hour component of current_date and the value of MINUTE to the Ml component of current_date. HOUR := to_Char(Current_date,'HH24'); MINUTE := to_Char(Current_date,'MI'); If HOUR is less than or equal to 8 , print the message "It is early in the day". If HOUR is greater than 8 and less than or equal to 16 , print the message "It is the middle of the day". If HOUR exceeds 16 , print the message "It is late in the day". If MINUTE is less than or equal to 20 , print the message "It is early in the hour". If MINUTE is greater than twenty but not more than 40 , print the message "It is the middle of the hour". Finally, if MINUTE exceeds 40 print the message "It is late in the hour". Sally Smith is a student at a college and has taken two courses. She received a B in CIS306 and an A in CIS406. CIS306 is a three hour course and CIS406 is a two hour course. Write the code to print Sally's transcript along with the GPA. Create separate variables for the student's first and last names. Display the GPA accurate to two decimal places. A student at the school is eligible to win the Gold Star award if (s)he earns an A in any course. However, to win the award the student must not receive any F's and must have a GPA of at least 2.5. The final result should look like what is displayed below. The last line prints only if the student wins the award. (Note: use the following to print a blank line: DBMS_Output.Put_Line (chr(0)); ) Student Sally Smith's Transcript CIS 306 B CIS 406 A The student has completed x Hours with a GPA of xx Sally has earned the Gold Star Award
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
