Adopt PL/SQL-Beautifier to Coding Guidelines ...

orca777

Member³
Hiu All,

searching for coding PL/SQL guidelines for a new architecture setup I found following very valuable PL/SQL-Guidelines:
http://www.williamrobertson.net/documents/plsqlcodingstandards.html

But the Beautifier is not capalbe yet to support some formatting, i like the formamtting of braces and commas :

Code:
TYPE status_rectype IS RECORD
( code     PLS_INTEGER
, message  VARCHAR2(1000) );

or SQL-formatting - keywords left-aligned but identifiers in vertical orientation

Code:
*

      SELECT last_name, first_name
      FROM   employees
      WHERE  department_id = 15
      AND    hire_date < SYSDATE;

    *

      INSERT INTO employees
      ( emp_id
      , emp_firstname
      , emp_lastname )
      VALUES
      ( emp_seq.NEXTVAL
      , r_emp.firstname
      , r_emp.lastname );

    *

      UPDATE employees
      SET    salary = salary * v_raise_factor
      WHERE  department_id = v_department_id
      AND    termination_date IS NULL;

a prcedure definition :

Code:
PROCEDURE do_stuff_rather_long_name
    ( p_first_parameter BOOLEAN DEFAULT FALSE
    , p_second_parameter SERVICE_AGREEMENT.AGREEMENT_STATUS%TYPE DEFAULT 2
    , p_third_parameter CURRENCY_AMOUNT DEFAULT 0 );

for a complete eye-opening example of the authors code :
http://www.williamrobertson.net/feed/2005/12/exception-object.html

Could PL/SQL-Developers Beautifer support this in future?

Another aspect could be to check code for coding style :
- do local vars start with 'v_%', local rowtypes vars start with 'r_%' or local objects start with 'o_%' or parameters start with 'p_%'?
just an idea

/Karl

 
Last edited:
Another aspect could be to check code for coding style :
- do local vars start with 'v_%', local rowtypes vars start with 'r_%' or local objects start with 'o_%' or parameters start with 'p_%'?
just an idea
Some or all of this is already included in PL/SQL Developer under Tools->Preferences->Hints->Naming Conventions.
 
Back
Top