Create a PL/SQL block that declares a cursor. Pass a parameter to the cursor of the type that is the same as the Salary column in EMPLOYEE table to the cursor. Open the cursor with a value for the parameter. Retrieve information into the cursor for a salary higher than the parameter value. Use a loop to print each employee’s information from the cursor (cursor with parameter problem).

What will be an ideal response?


```
SQL> DECLARE
2 CURSOR empcur (sal employee.Salary%TYPE) IS
3 SELECT Lname, Fname, Salary
4 FROM employee
5 WHERE Salary > sal;
6 sal_param employee.Salary%TYPE := &v_salary;
7 last employee.Lname%TYPE;
8 first employee.Fname%TYPE;
9 sal employee.Salary%TYPE;
10 BEGIN
11 OPEN empcur (sal_param);
12 FETCH empcur INTO last, first, sal;
13 WHILE empcur%FOUND LOOP
14 DBMS_OUTPUT.PUT_LINE(last||', '||first||' makes $'||sal);
15 FETCH empcur INTO last, first, sal;
16 END LOOP;
17 CLOSE empcur;
18 END;
19 /
Enter value for v_salary: 75000
Smith, John makes $265000
Houston, Larry makes $150000
Dev, Derek makes $80000

PL/SQL procedure successfully completed.
```

Computer Science & Information Technology

You might also like to view...

Why don’t smart pointers, using shared_ptr, work when there are circular references among nodes?

What will be an ideal response?

Computer Science & Information Technology

When naming a macro, the name CANNOT contain any ________

A) blank spaces B) underscores C) hyphens D) numbers

Computer Science & Information Technology

An autofocus camera mechanically adjusts the focal length by moving the lens in or out

Indicate whether the statement is true or false

Computer Science & Information Technology

By default, when a non-numeric field is added to a PivotTable, it is placed in the ________ area

A) VALUES Area B) FILTER Area C) ROWS Area D) COLUMNS Area

Computer Science & Information Technology