Question: SQL / PL 1 . In the following code, identify examples of these procedural constructs: variable, conditional control statement, reusable / callable program unit (

SQL/PL
1. In the following code, identify examples of these procedural constructs: variable, conditional control statement, reusable/callable program unit (functions or methods), assignment statement, and modular block structure.
DECLARE
v_first_name varchar2(40);
v_last_name varchar2(40);
v_first_letter varchar2(1);
BEGIN
SELECT first_name, last_name INTO v_first_name, v_last_name
FROM students
WHERE student_id =105;
v_first_letter := get_first_letter(v_last_name);
IF 'N'> v_first_letter THEN
DBMS_OUTPUT.PUT_LINE( v_last_name ||' is between A and M');
ELSE
DBMS_OUTPUT.PUT_LINE( v_last_name ||' is between N and Z');
END IF;
END;
a. Variables?
b. Conditional Control Statement?
c. Reusable/callable program units?
d. Assignment statement?
e. Modular block structure?
4. Which of the following PL/SQL blocks executes successfully? For the blocks that fail, explain why they fail.
a. BEGIN
END;
b. DECLARE
amount INTEGER(10);
END;
c. DECLARE
BEGIN
END;
d. DECLARE
amount INTEGER(10);
BEGIN
DBMS_OUTPUT.PUT_LINE(amount);
END;
5. Create and execute a simple anonymous PL/SQL block to accomplish the following:
Declares a variable (v_timestamp) of datatype DATE and populates it with the date that is six months from today using the DUAL table. Then, display the result on the screen.
Hint: use ADD_MONTHS(SYSDATE,6) to get six months from today.
Example Output: if today is Jan. 4.2021, the result should be 04-Jul-2021
6.Write and run SQL statements to perform the following tasks by using the tables below:
dd_donor
dd_project
dd_status
dd_pledge
dd_payment
a) List each donor who has made a pledge and paid in a single lump sum payment (i.e., where paymonths is equal to 0). Include the donors first name, last name, pledge date, and pledge amount.
Write your SQL statement and include a screenshot of the result here.
b) Display an unduplicated list of projects (ID and name) that have received pledges. Include only those projects with assigned pledges.
Write your SQL statement and include a screenshot of the result here.
c) Show the number of pledges made by each donor. Include the donor ID, first name, last name, and number of pledges.
Write your SQL statement and include a screenshot of the result here.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!