2021-04-28 16:28:15 +02:00
|
|
|
|
Unused cursor parameters are misleading. Whatever the values passed to such parameters, the behavior will be the same.
|
|
|
|
|
|
2021-04-28 18:08:03 +02:00
|
|
|
|
|
2021-04-28 16:28:15 +02:00
|
|
|
|
== Noncompliant Code Example
|
|
|
|
|
|
|
|
|
|
----
|
|
|
|
|
cursor c_list_emp(pp_country varchar2, pp_status varchar2) is -- Noncompliant pp_status is not used
|
|
|
|
|
select e.employee_code,
|
|
|
|
|
p.first_name,
|
|
|
|
|
p.last_name,
|
|
|
|
|
e.country
|
|
|
|
|
from persons p,
|
|
|
|
|
join employee_list e on e.person_id = p.person_id
|
|
|
|
|
where e.country = pp_country;
|
|
|
|
|
----
|
|
|
|
|
|
2021-04-28 18:08:03 +02:00
|
|
|
|
|
2021-04-28 16:28:15 +02:00
|
|
|
|
== Compliant Solution
|
|
|
|
|
|
|
|
|
|
----
|
|
|
|
|
cursor c_list_emp(pp_country varchar2, pp_status varchar2) is
|
|
|
|
|
select e.employee_code,
|
|
|
|
|
p.first_name,
|
|
|
|
|
p.last_name,
|
|
|
|
|
e.country
|
|
|
|
|
from persons p,
|
|
|
|
|
join employee_list e on e.person_id = p.person_id
|
|
|
|
|
where e.country = pp_country
|
|
|
|
|
and e.status_code = pp_status; -- use the parameter
|
|
|
|
|
----
|
|
|
|
|
or
|
|
|
|
|
|
|
|
|
|
----
|
|
|
|
|
cursor c_list_emp(pp_country varchar2) is -- Remove the parameter
|
|
|
|
|
select e.employee_code,
|
|
|
|
|
p.first_name,
|
|
|
|
|
p.last_name,
|
|
|
|
|
e.country
|
|
|
|
|
from persons p,
|
|
|
|
|
join employee_list e on e.person_id = p.person_id
|
|
|
|
|
where e.country = pp_country;
|
|
|
|
|
----
|
|
|
|
|
|
2021-04-28 18:08:03 +02:00
|
|
|
|
|