rspec/rules/S6048/plsql/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

67 lines
1.4 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

== 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
[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
[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
[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)
=== Message
Remove this unused parameter "{}".
=== Highlighting
The unused parameter
endif::env-github,rspecator-view[]