SonarSource Rules
  • Products

    In-IDE

    Code Quality and Security in your IDE with SonarQube Ide

    IDE extension that lets you fix coding issues before they exist!

    Discover SonarQube for IDE

    SaaS

    Code Quality and Security in the cloud with SonarQube Cloud

    Setup is effortless and analysis is automatic for most languages

    Discover SonarQube Cloud

    Self-Hosted

    Code Quality and Security Self-Hosted with SonarQube Server

    Fast, accurate analysis; enterprise scalability

    Discover SonarQube Server
  • SecretsSecrets
  • ABAPABAP
  • AnsibleAnsible
  • ApexApex
  • AzureResourceManagerAzureResourceManager
  • CC
  • C#C#
  • C++C++
  • CloudFormationCloudFormation
  • COBOLCOBOL
  • CSSCSS
  • DartDart
  • DockerDocker
  • FlexFlex
  • GitHub ActionsGitHub Actions
  • GoGo
  • GroovyGroovy
  • HTMLHTML
  • JavaJava
  • JavaScriptJavaScript
  • JSONJSON
  • JCLJCL
  • KotlinKotlin
  • KubernetesKubernetes
  • Objective CObjective C
  • PHPPHP
  • PL/IPL/I
  • PL/SQLPL/SQL
  • PythonPython
  • RPGRPG
  • RubyRuby
  • RustRust
  • ScalaScala
  • ShellShell
  • SwiftSwift
  • TerraformTerraform
  • TextText
  • TypeScriptTypeScript
  • T-SQLT-SQL
  • VB.NETVB.NET
  • VB6VB6
  • XMLXML
  • YAMLYAML
PL/SQL

PL/SQL static code analysis

Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code Smells in your PL/SQL code

  • All rules 189
  • Vulnerability4
  • Bug45
  • Security Hotspot2
  • Code Smell138
 
Tags
    Impact
      Clean code attribute
        1. GOTO should not be used to jump backwards

           Code Smell
        2. "EXIT" should not be used in loops

           Code Smell
        3. "GOTO" statements should not be used

           Code Smell
        4. Features deprecated in Oracle 18 should not be used

           Code Smell
        5. Cipher algorithms should be robust

           Vulnerability
        6. Identifiers should be written in lower case

           Code Smell
        7. SQL "JOIN" conditions should involve all joined tables

           Code Smell
        8. "TO_NUMBER" should be used with a format model

           Code Smell
        9. "SELECT" statements used as argument of "EXISTS" statements should be selective

           Code Smell
        10. Using weak hashing algorithms is security-sensitive

           Security Hotspot
        11. "CREATE_TIMER" should not be used

           Code Smell
        12. "SYNCHRONIZE" should not be used

           Bug
        13. "FORMS_DDL('COMMIT')" and "FORMS_DDL('ROLLBACK')" should not be used

           Bug
        14. "TO_DATE" and "TO_TIMESTAMP" should be used with a datetime format model

           Code Smell
        15. Features deprecated in Oracle 12 should not be used

           Code Smell
        16. Labels should not be reused in inner scopes

           Code Smell
        17. Output parameters should be assigned

           Bug
        18. "PLS_INTEGER" types should be used

           Code Smell
        19. "ROWNUM" should not be used at the same query level as "ORDER BY"

           Bug
        20. All branches in a conditional structure should not have exactly the same implementation

           Bug
        21. Strings should only be moved to variables or columns which are large enough to hold them

           Bug
        22. "FUNCTIONS" should not have "OUT" parameters

           Code Smell
        23. "COMMIT" should not be used inside a loop

           Bug
        24. Individual "WHERE" clause conditions should not be unconditionally true or false

           Bug
        25. "LIKE" clauses should not be used without wildcards

           Code Smell
        26. Nullable subqueries should not be used in "NOT IN" conditions

           Bug
        27. "WHERE" clause conditions should not be contradictory

           Bug
        28. Jump statements should not be redundant

           Code Smell
        29. Inserts should include values for non-null columns

           Bug
        30. Unary prefix operators should not be repeated

           Bug
        31. "EXCEPTION WHEN ... THEN" clauses should do more than "RAISE"

           Code Smell
        32. Weak "REF CURSOR" types should not be used

           Code Smell
        33. Variables should be nullable

           Code Smell
        34. Variables should be declared only once in a scope

           Bug
        35. "VARCHAR2" should be used

           Code Smell
        36. Native SQL joins should be used

           Code Smell
        37. "FORALL" should be used

           Code Smell
        38. "FETCH ... BULK COLLECT INTO" should be used

           Code Smell
        39. Column aliases should be defined using "AS"

           Code Smell
        40. Reserved words should be written in upper case

           Code Smell
        41. DML events clauses should not include multiple "OF" clauses

           Bug
        42. "COMMIT" and "ROLLBACK" should not be called from non-autonomous transaction triggers

           Bug
        43. Tables should be aliased

           Code Smell
        44. Procedures and functions should be encapsulated in packages

           Code Smell
        45. Size should be specified for string variables

           Bug
        46. Single line comments should start with "--"

           Code Smell
        47. "SIMPLE_INTEGER" should be used instead of "PLS_INTEGER"

           Code Smell
        48. Queries should not "SELECT" too many columns

           Code Smell
        49. "ROWID" and "UROWID" data types should not be used

           Code Smell
        50. "PACKAGE BODY" initialization sections should not contain "RETURN" statements

           Bug
        51. "RETURN" should not be used from within a loop

           Code Smell
        52. Quoted identifiers should not be used

           Code Smell
        53. Procedures should have parameters

           Code Smell
        54. "EXECUTE IMMEDIATE" should be used instead of DBMS_SQL procedure calls

           Code Smell
        55. Positional and named arguments should not be mixed in invocations

           Bug
        56. Parameter "IN" mode should be specified explicitly

           Code Smell
        57. Predefined exceptions should not be overridden

           Bug
        58. An "ORDER BY" direction should be specified explicitly

           Code Smell
        59. Oracle's join operator (+) should not be used

           Code Smell
        60. "NUMBER" variables should be declared with precision

           Code Smell
        61. "NULL" should not be compared directly

           Bug
        62. "NOT NULL" variables should be initialized

           Bug
        63. "cursor%NOTFOUND" should be used instead of "NOT cursor%FOUND"

           Code Smell
        64. Nested subqueries should be avoided

           Code Smell
        65. "NCHAR" and "NVARCHAR2" size should not be specified in bytes

           Bug
        66. "NATURAL JOIN" queries should not be used

           Code Smell
        67. Object attributes should comply with a naming convention

           Code Smell
        68. Record fields should comply with a naming convention

           Code Smell
        69. Cursors should follow a naming convention

           Code Smell
        70. Types should follow a naming convention

           Code Smell
        71. Cursor parameters should follow a naming convention

           Code Smell
        72. Exceptions should follow a naming convention

           Code Smell
        73. Lines in a multiline comment should start with "*"

           Code Smell
        74. "MLSLABEL" should not be used

           Bug
        75. Exceptions should not be ignored

           Code Smell
        76. "END" statements of labeled loops should be labeled

           Code Smell
        77. "END LOOP" should be followed by a semicolon

           Bug
        78. In labeled loops "EXIT" should exit the label

           Code Smell
        79. "EXIT WHEN" should be used rather than "IF ... THEN EXIT; END IF;"

           Code Smell
        80. "FOR" loop end conditions should not be hard-coded

           Code Smell
        81. Whitespace and control characters in string literals should be explicit

           Code Smell
        82. Nested loops should be labeled

           Code Smell
        83. Loop start and end labels should match

           Code Smell
        84. Block start and end labels should match

           Code Smell
        85. Nested blocks should be labeled

           Code Smell
        86. Constraints should not be applied to types that cannot be constrained

           Bug
        87. Large item lists should not be used with "IN" clauses

           Code Smell
        88. Variables should not be initialized with "NULL"

           Code Smell
        89. Improper constraint forms should not be used

           Bug
        90. "GOTO" should not be used within loops

           Code Smell
        91. "RESULT_CACHE" should not be used

           Code Smell
        92. Functions should end with "RETURN" statements

           Bug
        93. "FULL OUTER JOINS" should be used with caution

           Code Smell
        94. Collections should not be iterated in "FOR" loops

           Bug
        95. Scale should not be specified for float types

           Bug
        96. Blocks containing "EXECUTE IMMEDIATE" should trap all exceptions

           Code Smell
        97. "CASE" should be used rather than "DECODE"

           Code Smell
        98. "DBMS_OUTPUT.PUT_LINE" should not be used

           Code Smell
        99. "EXCEPTION_INIT -20,NNN" calls should be centralized

           Code Smell
        100. "CROSS JOIN" queries should not be used

           Code Smell
        101. "CREATE OR REPLACE" should be used instead of "CREATE"

           Code Smell
        102. Constant declarations should contain initialization assignments

           Bug
        103. Columns should be aliased

           Code Smell
        104. "VARCHAR2" and "NVARCHAR2" should be used

           Bug
        105. Block labels should appear on the same lines as "END"

           Code Smell
        106. "END" statements of labeled blocks should be labeled

           Code Smell
        107. "RAISE_APPLICATION_ERROR" should only be used with error codes from -20,000 to -20,999

           Bug
        108. "FETCH ... BULK COLLECT INTO" should not be used without a "LIMIT" clause

           Bug
        109. Anchored types should not be constrained

           Bug
        110. "LOOP ... END LOOP;" constructs should be avoided

           Code Smell
        111. Neither DES (Data Encryption Standard) nor DESede (3DES) should be used

           Vulnerability
        112. Track parsing failures

           Code Smell
        113. "WHEN OTHERS" should not be the only exception handler

           Code Smell
        114. CASE should be used for sequences of simple tests

           Code Smell
        115. SHA-1 and Message-Digest hash algorithms should not be used in secure contexts

           Vulnerability
        116. Global public variables should not be defined

           Code Smell
        117. Boolean checks should not be inverted

           Code Smell
        118. Files should not be too complex

           Code Smell
        119. Two branches in a conditional structure should not have exactly the same implementation

           Code Smell
        120. Related "IF/ELSIF" statements and "WHEN" clauses in a "CASE" should not have the same condition

           Bug
        121. Unused assignments should be removed

           Code Smell
        122. Identical expressions should not be used on both sides of a binary operator

           Bug
        123. All code should be reachable

           Bug
        124. Loops with at most one iteration should be refactored

           Bug
        125. "INSERT" statements should explicitly list the columns to be set

           Code Smell
        126. SQL tables should be joined with the "JOIN" keyword

           Code Smell
        127. "LIKE" clauses should not start with wildcard characters

           Code Smell
        128. Column names should be used in a SQL "ORDER BY" clause

           Code Smell
        129. "%TYPE" and "%ROWTYPE" should not be used in package specification

           Code Smell
        130. Variables and columns should not be self-assigned

           Bug
        131. Function and procedure parameters should comply with a naming convention

           Code Smell
        132. Procedures and functions should be documented

           Code Smell
        133. SQL statements should not join too many tables

           Code Smell
        134. Constraint names should comply with a naming convention

           Code Smell
        135. A primary key should be specified during table creation

           Code Smell
        136. "DELETE" and "UPDATE" statements should contain "WHERE" clauses

           Bug
        137. Magic literals should not be used

           Code Smell
        138. Explicitly opened cursors should be closed

           Bug
        139. "UNION" should be used with caution

           Code Smell
        140. "GROUP BY" should not be used in SQL "SELECT" statements

           Code Smell
        141. Function and procedure names should comply with a naming convention

           Code Smell
        142. Functions and procedures should not be too complex

           Code Smell
        143. Dynamically executing code is security-sensitive

           Security Hotspot
        144. Columns to be read with a "SELECT" statement should be clearly defined

           Code Smell
        145. Unused local variables should be removed

           Code Smell
        146. "CASE" structures should not have too many "WHEN" clauses

           Code Smell
        147. Deprecated LONG and LONG RAW datatypes should no longer be used

           Code Smell
        148. Track lack of copyright and license headers

           Code Smell
        149. Reserved words should be written in lower case

           Code Smell
        150. Track breaches of an XPath rule

           Code Smell
        151. Comments should not be located at the end of lines of code

           Code Smell
        152. "IF" statements should not be nested too deeply

           Code Smell
        153. "CASE" statements should end with "ELSE" clauses

           Code Smell
        154. Track uses of "NOSONAR" comments

           Code Smell
        155. "IF ... ELSEIF" constructs should end with "ELSE" clauses

           Code Smell
        156. Sections of code should not be commented out

           Code Smell
        157. Track comments matching a regular expression

           Code Smell
        158. Statements should be on separate lines

           Code Smell
        159. Package names should comply with a naming convention

           Code Smell
        160. String literals should not be duplicated

           Code Smell
        161. Unused procedure and function parameters should be removed

           Code Smell
        162. Variables should comply with a naming convention

           Code Smell
        163. "WHEN" clauses should not have too many lines

           Code Smell
        164. Constant names should comply with a naming convention

           Code Smell
        165. "IF" statement conditions should not evaluate unconditionally to "TRUE" or to "FALSE"

           Bug
        166. SQL EXISTS subqueries should not be used

           Code Smell
        167. Track uses of "TODO" tags

           Code Smell
        168. Track uses of "FIXME" tags

           Code Smell
        169. Lines should not end with trailing whitespaces

           Code Smell
        170. Return of boolean expressions should not be wrapped into an "if-then-else" statement

           Code Smell
        171. Boolean literals should not be redundant

           Code Smell
        172. Variables should not be shadowed

           Code Smell
        173. Redundant pairs of parentheses should be removed

           Code Smell
        174. Comments should not be nested

           Code Smell
        175. Magic numbers should not be used

           Code Smell
        176. "FORALL" statements should use the "SAVE EXCEPTIONS" clause

           Bug
        177. The "RELIES_ON" clause should not be used

           Code Smell
        178. The "result_cache" hint should be avoided

           Bug
        179. Functions and procedures should not have too many parameters

           Code Smell
        180. Mergeable "if" statements should be combined

           Code Smell
        181. Unused labels should be removed

           Code Smell
        182. "DBMS_UTILITY.FORMAT_ERROR_STACK" and "FORMAT_ERROR_BACKTRACE" should be used together

           Code Smell
        183. Pipelined functions should have at least one "PIPE ROW" statement and not return an expression (PLS-00633)

           Bug
        184. Sensitive "SYS" owned functions should not be used

           Vulnerability
        185. Compound triggers should define at least two triggers

           Code Smell
        186. "WHEN OTHERS" clauses should be used for exception handling

           Code Smell
        187. Files should not have too many lines of code

           Code Smell
        188. Lines should not be too long

           Code Smell
        189. Procedures should not contain "RETURN" statements

           Code Smell

        Deprecated LONG and LONG RAW datatypes should no longer be used

        consistency - conventional
        maintainability
        Code Smell
        • obsolete

        Why is this an issue?

        The LONG and LONG RAW datatypes are deprecated and Oracle recommends to migrate them to the LOB datatypes CLOB, NCLOB or BLOB.

        Noncompliant code example

        CREATE TABLE images(
          data LONG RAW
        );
        

        Compliant solution

        CREATE TABLE images(
          data BLOB
        );
        
          Available In:
        • SonarQube IdeCatch issues on the fly,
          in your IDE
        • SonarQube CloudDetect issues in your GitHub, Azure DevOps Services, Bitbucket Cloud, GitLab repositories
        • SonarQube ServerAnalyze code in your
          on-premise CI
          Developer Edition
          Available Since
          9.1

        © 2026 SonarSource Sàrl. All rights reserved.

        Privacy Policy | Cookie Policy | Terms of Use