08.01.2015 Views

phsjhxx

phsjhxx

phsjhxx

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5. Language Usage<br />

The language usage section is partly based on the rules defined within the tool CodeXpert<br />

by Quest Software (www.quest.com). All text taken directly from this source is marked by<br />

(CodeXpert). Every rule, that may be checked by CodeXpert ist marked with a red label<br />

including the rule number within CodeXpert.<br />

5.1. General<br />

1. Try to label your sub blocks.<br />

[CodeXpert 4403]<br />

2. Always have a matching loop or block label.<br />

[CodeXpert 4403]<br />

Reason: Use a label directly in front of loops and nested anonymous blocks:<br />

• To give a name to that portion of code and thereby selfdocument<br />

what it is doing.<br />

• So that you can repeat that name with the END statement of that<br />

block or loop.<br />

Example:<br />

-- Good<br />

BEGIN<br />

<br />

BEGIN<br />

…;<br />

END prepare_data;<br />

…<br />

END;<br />

<br />

BEGIN<br />

…<br />

END process_data;<br />

3. Avoid defining variables that are not used.<br />

[CodeXpert 6405]<br />

4. Avoid dead code in your programs.<br />

[CodeXpert 6801]<br />

Reason: Any part of your code, which is no longer used or cannot be reached,<br />

should be eliminated from your programs.<br />

5. Avoid using literals in your code.<br />

[CodeXpert 4602]<br />

Reason: Literals are often used more than once in your code. Having them defined<br />

as a constant reduces typos in your code.<br />

All constants should be collated in just one package used as a library. If<br />

these constants should be used in SQL too it is good practice to write a<br />

get_ deterministic package function for every constant.<br />

PL/SQL Coding Guidelines 17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!