Minor

Code Rules in Minor Severity

Category Severity Name Description
Maintainability Minor An ORDER BY direction should be specified explicitly

The rule "An ORDER BY direction should be specified explicitly" means that when using an ORDER BY clause in a PL/SQL statement, the direction of the ordering (ascending or descending) should be explicitly stated. This helps to ensure that the results are consistent and predictable. Without explicitly specifying the direction, the results may vary depending on the database engine being used.

Maintainability Minor Boolean checks should not be inverted

The rule "Boolean checks should not be inverted" states that Boolean checks should not be written in a way that reverses the logic of the check. This means that the code should not use "not" or "!" to invert the result of a Boolean check. Instead, the code should be written in a way that directly expresses the logic of the check.

Maintainability Minor Boolean literals should not be redundant

The "Boolean literals should not be redundant" rule states that when writing PL/SQL code, Boolean literals should not be used redundantly. This means that if a Boolean literal is already established, it should not be repeated. This rule is important for writing efficient and effective code, as repeating Boolean literals can lead to confusion and errors.

Maintainability Minor CASE should be used for sequences of simple tests The CASE statement should be used for sequences of simple tests in PL/SQL code. This statement is used to evaluate a set of conditions and execute a block of code depending on the result of the evaluation. The CASE statement can be used to replace multiple IF statements, making the code more concise and easier to read.
Maintainability Minor Code elements must not be unused

The Pl_Sql code rule "Code elements must not be unused" states that all code elements must be used in the code, and any code elements that are not used must be removed. This rule helps to ensure that the code is efficient, organized, and free of unnecessary clutter. Unused code elements can lead to confusion and can make the code harder to maintain. By removing unused code elements, the code will be easier to read and understand, and it will be easier to identify any potential errors.

Maintainability Minor Comments should not be located at the end of lines of code

The Pl/SQL code rule "Comments should not be located at the end of lines of code" means that comments should not be placed at the end of a line of code, as this can lead to confusion and errors. Comments should be placed on their own line, or at the beginning of a line of code, so that they are clearly visible and not mistaken for part of the code. This helps to ensure that the code is well-documented and easy to understand.

Maintainability Minor Comments should not be nested

The rule "Comments should not be nested" means that comments should not be placed within other comments. This is because comments are used to explain code and make it easier to read, and when they are nested they can become confusing and difficult to read. It is best practice to avoid nesting comments and instead use separate comments for each section of code.

Maintainability Minor Constraint names should comply with a naming convention

The rule "Constraint names should comply with a naming convention" states that all constraints in a PL/SQL code should have names that follow a specific naming convention. This ensures that the names of the constraints are consistent and easily identifiable. The naming convention should be agreed upon by the development team and should be documented in the project documentation. This will help to ensure that the names of the constraints are easily recognizable and understood by all members of the development team.

Maintainability Minor Cursor parameters should follow a naming convention

The Pl_Sql code rule "Cursor parameters should follow a naming convention" states that all cursor parameters should be named in a consistent manner. This helps to ensure that the code is easier to read and understand. For example, all cursor parameters should be prefixed with "cur_" to indicate that they are cursor parameters. This helps to differentiate them from other variables and makes the code more readable. Additionally, all cursor parameters should be named in a consistent manner, such as using camelCase or underscores. This helps to make the code more organized and easier to read. Following this rule will help to ensure that the code is more maintainable and easier to debug.

Maintainability Minor cursor%NOTFOUND should be used instead of NOT cursor%FOUND The PL/SQL code rule "cursor%NOTFOUND should be used instead of NOT cursor%FOUND" states that when checking if a cursor has returned any rows, the cursor%NOTFOUND attribute should be used instead of the NOT cursor%FOUND attribute. This is because the NOT cursor%FOUND attribute can return an unexpected result if the cursor has returned no rows. Using the cursor%NOTFOUND attribute will ensure that the correct result is returned.
Maintainability Minor Cursors should follow a naming convention

The rule "Cursors should follow a naming convention" states that all cursors used in PL/SQL code should be named in a consistent and logical manner. This helps to ensure that the code is easy to read and understand, and that any changes or additions to the code can be quickly identified. A good naming convention for cursors should include the purpose of the cursor, the type of data it is handling, and any other relevant information. For example, a cursor that is used to retrieve data from a table could be named "cur_table_data".

Maintainability Minor DBMS_UTILITY.FORMAT_ERROR_STACK and FORMAT_ERROR_BACKTRACE should be used together

The DBMS_UTILITY.FORMAT_ERROR_STACK and FORMAT_ERROR_BACKTRACE should be used together in order to get a comprehensive view of the error stack and backtrace. The FORMAT_ERROR_STACK function will return the error stack as a single string, while the FORMAT_ERROR_BACKTRACE function will return the backtrace as a single string. When used together, these functions will provide a comprehensive view of the error stack and backtrace, allowing for easier debugging and troubleshooting.

Maintainability Minor EXCEPTION WHEN ... THEN clauses should do more than RAISE The EXCEPTION WHEN ... THEN clauses should do more than just RAISE an exception. These clauses should also include additional logic to handle the exception, such as logging the error, rolling back the transaction, or performing other corrective actions. This helps to ensure that the application is robust and can handle unexpected errors.
Maintainability Minor Exceptions should follow a naming convention

The rule "Exceptions should follow a naming convention" states that all exceptions should be named in a consistent and logical manner. This helps to make the code easier to read and understand, and helps to prevent errors due to inconsistent naming. A naming convention should be established for exceptions, and all exceptions should follow this convention. This will help to ensure that all exceptions are named in a consistent and logical manner, and that they are easy to understand and debug.

Maintainability Minor EXIT should not be used in loops

The EXIT statement should not be used in loops in PL/SQL code. This is because the EXIT statement immediately exits the loop, which can lead to unexpected results. Instead, the loop should be ended by using the EXIT WHEN condition, which will exit the loop when the condition is met. This allows for more control over the loop and ensures that the loop will end when expected.

Bug Minor Explicitly opened cursors should be closed

The rule "Explicitly opened cursors should be closed" states that any cursors that have been explicitly opened in a PL/SQL block must be closed before the block is exited. This is important because it ensures that any resources associated with the cursor are released and that the cursor is no longer available for use. Failure to close an explicitly opened cursor can lead to unexpected behavior and errors when the block is executed. It is also important to note that cursors that are opened implicitly (i.e. not explicitly opened) do not need to be closed.

Maintainability Minor Identifiers should be written in lower case

The PL/SQL code rule "Identifiers should be written in lower case" states that all identifiers (such as variable names, procedure names, and table names) should be written using only lower case letters. This rule is important for readability and consistency, as well as to avoid potential conflicts with other identifiers. Additionally, this rule helps to ensure that code is compatible with different databases and platforms.

Maintainability Minor Jump statements should not be redundant

The rule "Jump statements should not be redundant" states that when writing PL/SQL code, unnecessary jump statements should be avoided. Jump statements are used to transfer control from one part of the code to another, and when they are redundant, they can cause confusion and make the code harder to read and understand. Therefore, it is important to ensure that all jump statements used in PL/SQL code are necessary and relevant to the code's purpose.

Maintainability Minor Lines in a multiline comment should start with *

The rule "Lines in a multiline comment should start with *" states that when writing a multiline comment in PL/SQL, each line should begin with an asterisk (*). This is a common convention for multiline comments in programming languages, and helps to make the code more readable and easier to understand.

Maintainability Minor Lines should not be too long

The Pl/SQL code rule "Lines should not be too long" means that code should be written in a way that each line does not exceed a certain length. This helps to make the code more readable and easier to debug. It also helps to keep the code organized and maintainable. Generally, lines should not exceed 80 characters in length, although this can vary depending on the coding style.

Maintainability Minor Methods must not be empty

The Pl_Sql code rule "Methods must not be empty" requires that all methods must contain executable code and must not be left empty. This rule ensures that all methods are properly implemented and that no code is left out or forgotten. It also helps to ensure that all methods are properly tested and that any errors or bugs are identified and fixed before the code is released. This rule helps to ensure that code is well-structured, efficient, and maintainable.

Maintainability Minor Naming conventions must be applied

The rule of "Naming conventions must be applied" in PL/SQL code means that all identifiers used in the code must follow a specific naming convention. This includes variables, constants, procedures, functions, packages, and other objects. The naming convention should be consistent across all code, and should be chosen to make the code easier to read and understand. For example, variables might be named using camel case, with the first letter of each word capitalized, and constants might be named using all uppercase letters. Following a naming convention makes it easier to read and understand the code, and helps to prevent errors.

Maintainability Minor Object attributes should comply with a naming convention

The Pl_Sql code rule "Object attributes should comply with a naming convention" states that all object attributes must adhere to a consistent naming convention. This ensures that the code is easier to read and understand, and that any changes to the code can be quickly identified. The naming convention should be documented and followed by all developers, and should include rules for capitalization, abbreviations, and the use of underscores. This will help to ensure that the code is consistent and maintainable.

Maintainability Minor Objects should not be duplicated (same name and same type)

The Pl_Sql code rule "Objects should not be duplicated (same name and same type)" means that objects within a Pl_Sql program should not have the same name and same type. This is because having multiple objects with the same name and type can lead to confusion and errors in the program. It is important to ensure that each object has a unique name and type to avoid any potential issues.

Maintainability Minor Oracle's join operator (+) should not be used

Oracle's join operator (+) should not be used as it is an outdated syntax that can lead to unexpected results. It is recommended to use the ANSI-standard JOIN syntax instead, which is more explicit and easier to read. Additionally, the ANSI-standard JOIN syntax is more efficient and can lead to better query performance.

Maintainability Minor Package names should comply with a naming convention

The rule "Package names should comply with a naming convention" states that when creating a package in PL/SQL, the package name should adhere to a specific naming convention. This naming convention should be consistent and easy to understand, and should be used for all packages created in the database. The naming convention should also be documented and shared with all developers who will be using the package. This will ensure that all packages are easily identifiable and that their purpose is clear. Additionally, it will help to prevent confusion and reduce the risk of errors.

Maintainability Minor Parameter IN mode should be specified explicitly

The rule "Parameter IN mode should be specified explicitly" states that when writing PL/SQL code, all parameters passed to a procedure or function must be explicitly declared as either IN or OUT parameters. This ensures that the code is clear and easy to understand, and that any potential errors are avoided. By explicitly declaring the mode of the parameter, the code is more self-documenting and easier to debug.

Maintainability Minor PLS_INTEGER types should be used

The rule "PLS_INTEGER types should be used" states that the PLS_INTEGER data type should be used when declaring variables, constants, and parameters in a PL/SQL program. PLS_INTEGER is a data type that is specifically designed for use in PL/SQL programs. It is a 32-bit signed integer data type that can store values between -2,147,483,648 and 2,147,483,647. This data type is more efficient than other integer data types, such as NUMBER, and is more reliable when dealing with large numbers. Using PLS_INTEGER types can help to improve the performance of a PL/SQL program.

Maintainability Minor Procedures should not contain RETURN statements

The rule that "Procedures should not contain RETURN statements" is an important one for PL/SQL code. This rule ensures that the procedure will always execute completely, regardless of the number of times it is called. A RETURN statement will cause the procedure to exit immediately, which can lead to unexpected results. Additionally, a RETURN statement can make it difficult to debug the procedure, as the code will not be executed in its entirety. By avoiding the use of RETURN statements in procedures, developers can ensure that the code will always execute as expected.

Maintainability Minor Record fields should comply with a naming convention

The Pl/SQL code rule "Record fields should comply with a naming convention" means that all record fields should be named in a consistent manner. This helps to ensure that the code is easier to read and understand. It also helps to prevent errors caused by typos or other mistakes. A naming convention could include using all lowercase letters, using underscores to separate words, and using prefixes or suffixes to indicate the data type of the field. Following a naming convention also helps to ensure that the code is consistent and organized.

Maintainability Minor Return of boolean expressions should not be wrapped into an if-then -else statement

The rule "Return of boolean expressions should not be wrapped into an if-then -else statement" in PL/SQL code means that boolean expressions should be returned directly without the need for an if-then-else statement. This is because boolean expressions already return either true or false, so there is no need to wrap them in an if-then-else statement. This makes the code more efficient and easier to read.

Maintainability Minor Scripts must be commented

The rule "Scripts must be commented" states that all PL/SQL scripts must be accompanied by comments that explain the purpose of the code and any other relevant information. This helps to ensure that the code is understandable and maintainable, and can help to identify potential errors. Additionally, it allows for easier debugging and troubleshooting of the code. By commenting code, developers can ensure that their code is understood by other developers and can be easily modified or updated in the future.

Maintainability Minor Scripts must not exceed a certain size

The Pl_Sql code rule "Scripts must not exceed a certain size" states that all scripts written in Pl_Sql must not exceed a predetermined size limit. This rule is in place to ensure that scripts remain manageable and efficient, and that they do not become too large and unwieldy. This rule helps to ensure that scripts are written in a way that is easy to read, debug, and maintain. It also helps to prevent scripts from becoming too complex and difficult to understand.

Maintainability Minor Single line comments should start with --

The rule "Single line comments should start with --" states that any single line comments in PL/SQL code should begin with two hyphens (--). This is used to differentiate comments from other code, and to ensure that the comments are properly identified and ignored by the PL/SQL interpreter.

Maintainability Minor SQL tables should be joined with the JOIN keyword

The rule "SQL tables should be joined with the JOIN keyword" states that when two or more tables are being combined in a SQL query, the JOIN keyword should be used to join the tables together. This ensures that the query is properly structured and that the data is properly retrieved from the database. The JOIN keyword allows for the use of various types of joins such as inner, left, right, and full outer joins. This allows the query to be more specific and to retrieve only the data that is needed. Additionally, the JOIN keyword allows for the use of various types of conditions such as equality, inequality, and range conditions. This allows for more flexibility when writing SQL queries.

Maintainability Minor String literals should not be duplicated

The rule "String literals should not be duplicated" states that when writing PL/SQL code, string literals should not be repeated unnecessarily. This means that when a string literal is used multiple times in a code block, it should be assigned to a variable and then the variable should be used instead of the literal. This helps to improve code readability and maintainability, as well as reducing the amount of code that needs to be written.

Maintainability Minor The RELIES_ON clause should not be used

The RELIES_ON clause should not be used as it can lead to unexpected results and can cause the code to be difficult to maintain. This clause is used to indicate that the execution of a particular statement depends on the successful execution of a previous statement. This can lead to unpredictable results and can cause the code to become difficult to maintain. Additionally, it can also lead to performance issues as the code may not be optimized for the best performance. Therefore, it is best to avoid using the RELIES_ON clause in PL/SQL code.

Maintainability Minor Types should follow a naming convention

The rule "Types should follow a naming convention" states that all PL/SQL types should be named in a consistent and logical manner. This helps to ensure that the code is easier to read and understand. Naming conventions should include prefixes, suffixes, and capitalization to distinguish between different types. For example, a type that stores a customer's name could be named "CUST_NAME_TYPE". This helps to make the code more readable and easier to maintain. Additionally, it can help to prevent naming conflicts between different types.

Maintainability Minor Unused local variables should be removed

The rule "Unused local variables should be removed" states that any local variables declared in a PL/SQL code block that are not used should be removed. This is to ensure that the code is as efficient as possible, and that any unnecessary code is not taking up space. Unused variables can also lead to confusion and errors, so it is important to remove them in order to keep the code clean and organized.

Maintainability Minor Variables Naming Convention

The Pl/SQL Variables Naming Convention is a set of rules for naming variables in the Pl/SQL programming language. This convention helps to ensure that variables are named in a consistent and logical manner, making code easier to read and understand. The convention states that all variables should be named using only alphanumeric characters, and should begin with a letter. Variables should also be named in a descriptive manner, using words that accurately describe the purpose of the variable. Additionally, variables should be named using a combination of lowercase and uppercase letters, with the first letter of each word in the variable name being uppercase. This helps to make the variable name more readable and easier to understand.

Maintainability Minor Variables should not be initialized with NULL

The Pl_Sql code rule "Variables should not be initialized with NULL" states that variables should not be assigned the value NULL when they are declared. This is because NULL is a special value that indicates that the variable has no value assigned to it. Instead, variables should be assigned an appropriate value that reflects the data type of the variable. This will ensure that the variable is properly initialized and can be used in the code.