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

Triggers should not "PRINT", "SELECT", or "FETCH"

    XMLWordPrintable

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Remove this "xxx" statement from this trigger; its output is likely to be ignored.
    • Highlighting:
      Hide

      PRINT | SELECT | FETCH

      Show
      PRINT | SELECT | FETCH
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Targeted languages:
      ABAP, Cobol, PL/SQL, RPG
    • Covered Languages:
      T-SQL
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      15min
    • Analysis Scope:
      Main Sources, Test Sources

      Description

      There's almost no point in returning results from a trigger. Because there is generally no expectation that triggers will return anything, any such results are likely to be ignored nearly all the time.

      This rule raises an issue when PRINT is used inside a trigger, and when SELECT, or FETCH is used inside a trigger without the retrieved data subsequently being used inside the trigger itself.

      Noncompliant Code Example

      ALTER TRIGGER TRG_myTrigger
      ...
        PRINT @diagnostic_message -- Noncompliant
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              ann.campbell.2 Ann Campbell
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: