Home Page Icon
Home Page
Table of Contents for
7.2. Functions
Close
7.2. Functions
by Steven Feuerstein
Oracle PL/SQL Best Practices
A Note Regarding Supplemental Files
Dedication
Preface
Structure of This Book
How to Use This Book
Not All Best Practices Are Created Equal
About the Code
Other Resources
Conventions Used in This Book
Comments and Questions
Acknowledgments
1. The Development Process
DEV-01: Set standards and guidelines before writing any code.
DEV-02: Ask for help after 30 minutes on a problem.
DEV-03: Walk through each other’s code.
DEV-04: Validate standards against source code in the database.
DEV-05: Generate code whenever possible and appropriate.
DEV-06: Set up and use formal unit testing procedures.
DEV-07: Get independent testers for functional sign-off.
2. Coding Style and Conventions
STYL-01: Adopt a consistent, readable format that is easy to maintain.
STYL-02: Adopt logical, consistent naming conventions for modules and data structures.
STYL-03: Standardize module and program headers.
STYL-04: Tag module END statements with module names.
STYL-05: Name procedures with verb phrases and functions with noun phrases.
STYL-06: Self-document using block and loop labels.
STYL-07: Express complex expressions unambiguously using parentheses.
STYL-08: Use vertical code alignment to emphasize vertical relationships.
STYL-09: Comment tersely with value-added information.
STYL-10: Adopt meaningful naming conventions for source files.
3. Variables and Data Structures
3.1. Declaring Variables and Data Structures
3.2. Using Variables and Data Structures
3.3. Declaring and Using Package Variables
4. Control Structures
4.1. Conditional and Boolean Logic
4.2. Loop Processing
4.3. Miscellaneous
5. Exception Handling
EXC-00: Set guidelines for application-wide error handling before you start coding.
5.1. Raising Exceptions
5.2. Handling Exceptions
5.3. Declaring Exceptions
6. Writing SQL in PL/SQL
SQL-00: Establish and follow clear rules for how to write SQL in your application.
6.1. General SQL and Transaction Management
6.2. Querying Data from PL/SQL
6.3. Changing Data from PL/SQL
6.4. Dynamic SQL and Dynamic PL/SQL
7. Program Construction
7.1. Structure and Parameters
7.2. Functions
7.3. Triggers
8. Package Construction
PKG-01: Group related data structures and functionality together in a single package.
PKG-02: Provide well-defined interfaces to business data and functional manipulation using packages.
PKG-03: Freeze and build package specifications before implementing package bodies.
PKG-04: Implement flexible, user-adjustable functionality using package state toggles and related techniques.
PKG-05: Build trace “windows” into your packages using standardized programs.
PKG-06: Use package body persistent data structures to cache and optimize data-driven processing.
PKG-07: Insulate applications from Oracle version sensitivity using version-specific implementations.
PKG-08: Avoid bloating package code with unnecessary but easy-to-build modules.
PKG-09: Simplify and encourage module usage using overloading to widen calling options.
PKG-10: Consolidate the implementation of related overloaded modules.
PKG-11: Separate package specifications and bodies into different source code files.
PKG-12: Use a standard format for packages that include comment headers for each type of element defined in the package.
9. Built-in Packages
9.1. DBMS_OUTPUT
9.2. UTL_FILE
9.3. DBMS_PIPE
9.4. DBMS_ JOB
A. Best Practices Quick Reference
A.1. The Development Process
A.2. Coding Style and Conventions
A.3. Variables and Data Structures
Declaring Variables and Data Structures
Using Variables and Data Structures
Declaring and Using Package Variables
A.4. Control Structures
Conditional and Boolean Logic
Loop Processing
Miscellaneous
A.5. Exception Handling
Raising Exceptions
Handling Exceptions
Declaring Exceptions
A.6. Writing SQL in PL/SQL
General SQL and Transaction Management
Querying Data from PL/SQL
Changing Data from PL/SQL
Dynamic SQL and Dynamic PL/SQL
A.7. Program Construction
Structure and Parameters
Functions
Triggers
A.8. Package Construction
A.9. Built-in Packages
DBMS_OUTPUT
UTL_FILE
DBMS_PIPE
DBMS_ JOB
About the Author
Colophon
Copyright
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
MOD-06: Use NOCOPY to minimize overhead when collections and records are [IN] OUT parameters (Oracle8i).
Next
Next Chapter
MOD-07: Limit functions to a single RETURN statement in the execution section.
Functions
Functions are program units that return a value through the RETURN clause of the program header.
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset