rspec/rules/S6048/plsql/rule.adoc

61 lines
1.4 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
Unused cursor parameters are misleading. Whatever the values passed to such parameters, the behavior will be the same.
=== Noncompliant code example
2022-02-04 17:28:24 +01:00
[source,sql]
----
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;
----
=== Compliant solution
2022-02-04 17:28:24 +01:00
[source,sql]
----
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
2022-02-04 17:28:24 +01:00
[source,sql]
----
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;
----
 
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
include::highlighting.adoc[]
endif::env-github,rspecator-view[]