Skip to content

Trivadis PL/SQL & SQL Coding Guidelines v4.0

Compare
Choose a tag to compare
@kibeha kibeha released this 03 Feb 19:33
· 388 commits to main since this release

Version 4.0

https://trivadis.github.io/plsql-and-sql-coding-guidelines/v4.0/
PLSQL-and-SQL-Coding-Guidelines.pdf

Breaking Changes

  • #57 - Changed Code Style Rule 1 from “Keywords are written uppercase, names are written in lowercase“ to "Keywords and names are written in lowercase”
    • added reason for this change
    • updated all code examples
  • #81 - Removed G-7240 (Avoid using an IN OUT parameter as IN or OUT only) and replaced it with these rules:
    • G-7160: Always explicitly state parameter mode.
    • G-7170: Avoid using an IN OUT parameter as IN or OUT only.

New

  • #28 - G-1080: Avoid using the same expression on both sides of a relational comparison operator or a logical operator.
  • #48 - G-2135: Avoid assigning values to local variables that are not used by a subsequent statement.
  • #34 - G-2145: Never self-assign a variable.
  • #54 - G-2610: Never use self-defined weak ref cursor types.
  • #34 - G-3115: Avoid self-assigning a column.
  • #26 - G-3185: Never use ROWNUM at the same query level as ORDER BY.
  • #38 - G-3195: Always use wildcards in a LIKE clause.
  • #22 - G-3310: Never commit within a cursor loop.
  • #22 - G-3320: Try to move transactions within a non-cursor loop into procedures.
  • #31 - G-4250: Avoid using identical conditions in different branches of the same IF or CASE statement.
  • #44/#90 - G-4260: Avoid inverting boolean conditions with NOT.
  • #45 - G-4270: Avoid comparing boolean values to boolean literals.
  • #50 - G-4325: Never reuse labels in inner scopes.
  • #36 - G-5080: Always use FORMAT_ERROR_BACKTRACE when using FORMAT_ERROR_STACK or SQLERRM.
  • #35 - G-7125: Always use CREATE OR REPLACE instead of CREATE alone.
  • #25 - G-7250: Never use RETURN in package initialization block.
  • #30 - G-7330: Always assign values to OUT parameters.
  • #27 - G-7720: Never use multiple UPDATE OF in trigger event clause.
  • #84 - G-7730: Avoid multiple DML events per trigger if primary key is assigned in trigger.
  • #40 - G-9010: Always use a format model in string to date/time conversion functions.
  • #40 - G-9020: Try to use a format model and NLS_NUMERIC_CHARACTERS in string to number conversion functions.
  • #40 - G-9030: Try to define a default value on conversion errors.
  • #88/#89 - Added "Unsupported in PL/SQL Cop Validators” section for every guideline without validator in PL/SQL Cop

Changed

  • #77 - G-5040: Added exception for logging framework calls
  • #78 - G-1050: Added exception for logging framework calls
  • #79 - G-7230: Added exception for constants
  • #85 - G-4220: Added warning regarding different NULL handling in DECODE and CASE
  • #93/#98 - Updated Appendix B with changed/new rules
  • #95 - Updated trivadis/mktools docker image
  • #97 - Included Material for MkDocs 6.0 in trivadis/mktools docker image

Fixed

  • #87 - Fixed typo in coding-style.md
  • #92 - G-3190 added a newline
  • #94 - G-3310 added a better example