Files
pmd/docs/pages/pmd/rules/plsql/codestyle.md
2017-11-03 16:30:15 +01:00

1.2 KiB

title, summary, permalink, folder, sidebaractiveurl, editmepath, keywords
title summary permalink folder sidebaractiveurl editmepath keywords
Codestyle Rules which enforce a specific coding style. pmd_rules_plsql_codestyle.html pmd/rules/plsql /pmd_rules_plsql.html ../pmd-plsql/src/main/resources/category/plsql/codestyle.xml Codestyle, MisplacedPragma

MisplacedPragma

Since: PMD 5.5.2

Priority: Medium (3)

Oracle states that the PRAQMA AUTONOMOUS_TRANSACTION must be in the declaration block, but the code does not complain, when being compiled on the 11g DB. https://docs.oracle.com/cd/B28359_01/appdev.111/b28370/static.htm#BABIIHBJ

//ProgramUnit/Pragma

Example(s):

create or replace package inline_pragma_error is

end;
/

create or replace package body inline_pragma_error is
  procedure do_transaction(p_input_token        in varchar(200)) is
  PRAGMA AUTONOMOUS_TRANSACTION; /* this is correct place for PRAGMA */
  begin
    PRAGMA AUTONOMOUS_TRANSACTION; /* this is the wrong place for PRAGMA -> violation */
    /* do something */
    COMMIT;
   end do_transaction;

end inline_pragma_error;
/

Use this rule by referencing it:

<rule ref="rulesets/plsql/codestyle.xml/MisplacedPragma" />