Create a PL/SQL block to increase salary of employees in department 10. The salary increase is 15% for the employees making less than $100,000 and 10% for the employees making $100,000 or more. Use a cursor with a FOR UPDATE clause. Update the salary with a WHERE CURRENT OF clause in a cursor FOR loop (cursor FOR loop problem).

What will be an ideal response?


```
SQL> DECLARE
2 first employee.Fname%TYPE;
3 last employee.Lname%TYPE;
4 qual employee.QualId%TYPE;
5 Sal employee.Salary%TYPE;
6 v_qualId employee.QualId%TYPE := &Qualification_Id;
7 BEGIN
8 SELECT Lname, Fname, QualId, Salary
9 INTO last, first, qual, sal
10 FROM employee
11 WHERE QualId = v_qualId;
12 DBMS_OUTPUT.PUT_LINE(last || ', ' || first);
13 DBMS_OUTPUT.PUT_LINE('Qualification: ' || qual);
14 DBMS_OUTPUT.PUT_LINE('Salary: ' || sal);
15 EXCEPTION
16 WHEN NO_DATA_FOUND THEN
17 DBMS_OUTPUT.PUT_LINE
18 ('No employees with such qualification');
19 WHEN TOO_MANY_ROWS THEN
20 DBMS_OUTPUT.PUT_LINE
21 ('More than employee with qualification ' || v_qualId);
22 END;
23 /
Enter value for qualification_id: 7
No employees with such qualification

PL/SQL procedure successfully completed.

SQL> /
Enter value for qualification_id: 1
More than employee with qualification 1

PL/SQL procedure successfully completed.

SQL> /
Enter value for qualification_id: 5
Garner, Stanley
Qualification: 5
Salary: 45000

PL/SQL procedure successfully completed.
```

Computer Science & Information Technology

You might also like to view...

In the case of a(n) ____ incident, the aim of incident response management is to ensure that the nature of the incident is understood in as timely a fashion as possible, and that the best possible response is deployed.

A. expected B. possible C. unforeseen D. probable

Computer Science & Information Technology

In the ____________________ topology all nodes are connected to a single, shared communication line.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

The Report Header will display information at the top of every page.

a. true b. false

Computer Science & Information Technology

To draw a Clustered Cylinder chart, first select the data to be charted and then click the Column button (Insert tab | Charts group).

Answer the following statement true (T) or false (F)

Computer Science & Information Technology