Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-6048

Unused cursor parameters should be removed

    XMLWordPrintable

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Remove this unused parameter "{}".
    • Highlighting:
      Hide

      The unused parameter

      Show
      The unused parameter
    • Default Severity:
      Major
    • Impact:
      Low
    • Likelihood:
      High
    • Default Quality Profiles:
      Sonar way
    • Targeted languages:
      PL/SQL
    • Irrelevant for Languages:
      ABAP, APEX, C#, C, C++, Cobol, CSS, Flex, Go, HTML, Java, JavaScript, Kotlin, Objective-C, PHP, PL/I, Python, RPG, Ruby, Rust, Scala, Solidity, Swift, T-SQL, TypeScript, VB.Net, VB6, XML
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      5min
    • Analysis Level:
      Semantic Analysis
    • Analysis Scope:
      Main Sources, Test Sources

      Description

      Unused cursor parameters are misleading. Whatever the values passed to such parameters, the behavior will be the same.

      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;
      

      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;
      

       

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            nicolas.harraudeau Nicolas Harraudeau (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: