[PDF] Searches related to pl/sql best practices filetype:pdf





Previous PDF Next PDF



Doing SQL from PL/SQL: Best and Worst Practices

21 ????. 2008 ?. This paper examines and categorizes the use cases for doing SQL from. PL/SQL takes the Oracle Database 11g viewpoint



Best Practices for PL/SQL

Critical elements of PL/SQL Best Practices. ? Build your development toolbox. ? Unit test PL/SQL programs. ? Optimize SQL in PL/SQL programs.



Oracle PLSQL Coding Guidelines 1. Overview 2. Standards

All PL/SQL functions and procedures will be implemented as part of a package. The package Oracle PL/SQL Best Practices Steven Feuerstein



Best Practices for Globalization using the Oracle 9i Internet

12 ???. 2001 ?. Best Practices. Globalization. Oracle Technology Network. Oracle 9i Internet Application Server. 10. PL/SQL and PSP run on an Oracle9i ...



Best Practices for Migrating from Oracle to Amazon Aurora

DMS Best Practices. • How AWS Can Help pg/PLSQL. Data. •. Switch Database engine from Oracle to. PostgreSQL. •. Evolve from customer-managed to.



Oracle BI Publisher Best Practices for SaaS Environments

If the SQL query is still processing when the time out value is met the error "Failed to retrieve data xml." is returned. Enter a value in seconds. If you do 



Redo Apply Best Practices - Oracle Data Guard and Active Data Guard

The number of apply instances is controlled by the Data Guard Broker database property ApplyInstances or the following SQL*Plus command;. ALTER DATABASE RECOVER 



Oracle 10gR2 Forms Services – Best Practices for Application

Surely this is denying the programmer his or her right to free expression and artistry in code! PL/SQL is a language that allows a lot (possibly too much) of 



Application Development Best Practices for Oracle Real Application

For queues being accessed through the AQ PL/SQL APIs the performance of. AQ can be improved by allowing different queues to be managed by different RAC 



SQL Apply Best Practices: Oracle Data Guard 11g Release 1

1 ????. 2008 ?. This white paper discusses the MAA best practices for SQL Apply in Oracle Database 11g Release 1 (11.1) and it assumes you have already ...



Doing SQL from PL/SQL: Best and Worst Practices - Oracle

Doing SQL from PL/SQL: Best and Worst Practices page 2 21-September-2008 www oracle com/technology/tech/pl_sql/ pdf /doing_sql_from_plsql pdf INTRODUCTION This paper is written for the Oracle Database developer who has reasonable familiarity with programming database PL/SQL units and who in particular has



Oracle PLSQL Best Practices - UMM

Mastering Oracle PL/SQL: Practical Solutions CONNOR MCDONALD WITH CHAIM KATZ CHRISTOPHER BECK JOEL R KALLMAN AND DAVID C KNOX 2174fmfinal qxd 11/24/03 4:02 PM Page i Mastering Oracle PL/SQL: Practical Solutions Copyright © 2004 by Connor McDonald with Chaim Katz Christopher Beck Joel R Kallman and David C Knox All rights reserved



PL/SQL Best Practices - Amazon Web Services Inc

PL/SQL Best Practices You can define some parts of your code as public (accessible by others) and other areas as private (accessible only by your code) This improves the quality of your code It's easier to debug and enhance because code is split into functional areas



Best Practice PL/SQL - New York Oracle User Group

Let's face it: we PL/SQL developers don't spend nearly enough time unit testing our code – For the most part we run a script that displays output on the screen and then we stare at all until we decide if the test s?ded or failed There are some understandable reasons: – Very few tools and utilities have been available to date for



Oracle PLSQL Best Practices - doclagoutorg

Oracle PL/SQL Best Practicesis a concise easy-to-use summary of best practices in the program development process It covers coding style writing SQL in PL/SQL data structures control structures exception handling program and package construction and built-in packages Complementary code examples are available on the O'Reilly web site



Searches related to pl/sql best practices filetype:pdf

Oracle PLSQL Coding Guidelines Overview 1 1 Scope This document defines the standards and guidelines that will be used by developers when submitting PL/SQL components These guidelines will also be used by reviewers to determine whether a component submission meets TopCoder standards 2 Standards 2 1 Packages and Procedures

What is Oracle PL/SQL best practices?

    Oracle PL/SQL Best Practices is a concise, easy-to-use summary of best practices in the program development process. It covers coding style, writing SQL in PL/SQL, data structures, control structures, exception handling, program and package construction, and built-in packages.

What are Oracle PLSQL coding guidelines?

    Oracle PLSQL Coding Guidelines 1. This document defines the standards and guidelines that will be used by developers when submitting PL/SQL components. These guidelines will also be used by reviewers to determine whether a component submission meets TopCoder standards.

What are the best practices for querying relational databases with SQL?

    Below is a list of best practices for database programmers and database administrators to follow when querying relational databases with SQL. Perhaps one of the most basic best practices for SQL is to always ensure that you are using uppercase letters for your SQL keywords.

Confidential

TopCoder Software, Inc. 2002 Page 1

Oracle PLSQL Coding Guidelines

1. Overview

1.1 Scope

This document defines the standards and guidelines that will be used by developers when submitting PL/SQL components. These guidelines will also be used by reviewers to determine whether a component submission meets TopCoder standards.

2. Standards

2.1 Packages and Procedures

All PL/SQL functions and procedures will be implemented as part of a package. The package names used will be specified in the component specification.

2.2 Unit Testing

All submitted components will include unit tests written with the 'utPLSQL' package. The package is available at the URL given in the 'references' section of this document.

2.3 Source Files

Package headers and bodies will be declared in separate files. Package header file names will use the 'pkg' extension. Package body file names will use the '.pkb' extension. Trigger code will be declared in a single file with the extension '.trg'.

2.3.1 Header Comments

Package header source files will contain a package level comment which includes the following information: FileName, Component Name, Description, Package Name, Designer Name, Developer Name, Version, Date and Copyright statement. The format below will be followed exactly. /* Filename: TopCoder_Unit_Test.pkg /* Component: Unit_Test_Framework /* Package: Unit_Test_Frmwrk /* Designer: TCSDesigner /* Developer: TCSDeveloper /* Version: 1.0 /* Copyright (c) 2006, TopCoder, Inc. All rights reserved. /* Description: Description of PL/SQL package... These comments will be used at a later time by an automated comment generator (possibly

RoboDoc) to generate HTML package documentation.

2.3.2 Function/Procedure Comments

The package header source file will document each function in the following format: /** Function: get_employee_ssn

Confidential

TopCoder Software, Inc. 2002 Page 2

/** In: p_employee_id - the id of the employee to search for /** Returns: the Social Security Number for the employee The package header source file will document each procedure in the following format: /** Procedure: ins_employee /** Out: p_employee_id - the id of the newly created employee. /** In: p_ssn - the Social Security Number of the employee to /** insert. /** In: p_name - the name of the employee to insert. The possible parameter types are 'In', 'Out' and 'InOut'. These comments will be used at a later time by an automated comment generator (possibly RoboDoc) to generate HTML package documentation.

2.3.3 Maximum Line Length

No single line of code in a PL/SQL component will exceed 120 characters in length.

2.3.4 Indentation

Indentation will be 0 spaces for the outermost block and 3 spaces from the indentation level of each enclosing block.

2.3.5 Alignment

Comma separated lists will be 'stacked' and aligned as shown below:

SELECT SUM(A)

, B , C

FROM TABLE1

WHERE B = 5

GROUP BY B

, C

2.3.6 Conditional Blocks

In a conditional, the 'THEN' keyword will be placed on the line below the 'IF' but aligned with it. 'ELSEIF' keywords will also be aligned with the 'IF'.

Example:

IF l_total > lc_max

THEN l_new_max := true;

ELSIF l_total = lc_max

THEN l_new_max := false;

END IF;

2.4 Reserved Words

SQL and PL/SQL reserved words (SELECT, INSERT, PACKAGE, FUNCTION, etc) will be capitalized.

Confidential

TopCoder Software, Inc. 2002 Page 3

2.5 Variable Names

Variable names will be all lower case, with individual words separated by an underscore. The following standard prefixes will be used:

Prefix Usage Context

p_ Function and procedure parameters l_ Function and procedure local variables g_ Package global variables lc_ Function and procedure local constants gc_ Package global constants

2.6 Variable Types

2.6.1 Row and Column Types

When there is a direct correlation between a variable and a table column, the %TYPE or %ROWTYPE will be used.

Example:

DECLARE

l_wins team.wins%TYPE;

2.6.2 Subtypes

When there's no direct correlation between a variable and table column variable restrictions will not be hard-coded. The developer will use 'SUBTYPE' to standardize data types.

Example:

CREATE OR REPLACE PACKAGE team_data

SUBTYPE total_win_count_t IS INTEGER(10);

DECLARE

l_win_count team_data.total_win_count_t;

2.7 Variable Initialization

Variables will only be initialized in the 'DECLARE' section when that initialization doesn't require a

function call or complex logic. When the variable must be initialized via a function call or complex

logic, it will be done in the executable section of the procedure or function.

2.8 Function and Procedure Naming

Functions and procedures will be names using the following guidelines. Functions and procedures that don't fall into one of these usage contexts will be named descriptively at the developer's discretion.

Prefix Usage Context

ins_ Procedures whose primary purpose is to insert data upd_ Procedures whose primary purpose is to update data del_ Procedures whose primary purpose is to delete data get_ Functions whose primary purpose is to retrieve data chk_ Functions which return a Boolean value

Confidential

TopCoder Software, Inc. 2002 Page 4

2.9 Encapsulation

2.9.1 DML Statements

Insert and Update statements will be encapsulated in a single package procedure or function. This will allow all inserts and updates to use identical SQL which will decrease statement parsing.

2.9.2 Package Data

Non-constant package level data will be declared in the package body (privately), not in the package specification. 'get_' and (optionally) 'set_' procedures will be included to modify this data from outside the package when necessary. The package specification may include constant, type and cursor definitions.

2.10 Control Structures

2.10.1 Conditionals

The 'ELSIF/ELSE' construct will be used in preference to multiple or nested conditionals.

Example:

These statements:

IF l_count_1 = l_count_2

THEN // handle case 1

END IF;

IF l_count_1 > l_count_2

THEN // handle case 2 ELSE

IF l_count_2 > l_count1

THEN // handle case 3

END IF;

END IF;

Should be written as:

IF l_count_1 = l_count_2

THEN // handle case 1

ELSIF l_count_1 > l_count_2

THEN // handle case 2

ELSIF l_count_2 > l_count1

THEN // handle case 3

END IF;

2.10.2 Loop Exits

It's considered bad practice to exit from the middle of a loop. Each loop should include only a single exit point.

2.10.3 GOTO Statement

PL/SQL's GOTO statement will not be used.

Confidential

TopCoder Software, Inc. 2002 Page 5

2.11 Exceptions

2.11.1 Raising Exceptions

PL/SQL components will not raise exceptions directly. The component will use a single procedure to encapsulate exception raising logic. Exceptions will be used to indicate errors, not as a normal method for branching control.

2.11.2 Custom Exceptions

Custom exceptions will be declared in the package specification. Custom exceptions will not hide an underlying exception. For example, the developer should not catch a system-created exception and then raise an application exception instead.

2.11.3 Exception Handling

Exception handling code will catch specific exceptions and will only use the 'WHEN OTHERS' construct in the outermost code. Every effort should be made to preserve the root cause of exceptions to the client code.

2.12 Cursors

2.12.1 Declarations

Multi-row cursors are often useful to users outside the package and should be included in the package specification at the designer's discretion.

2.12.2 Cursor For Loop

A cursor for loop will not be used to retrieve a single row. Cursor for loops will only be used when

every row in the cursor will be processed. If the loop exits before the all rows are read from the cursor, then the cursor will not be properly closed.

2.12.3 Fetching

Cursors will be fetched into cursor records, not into multiple variables.

2.12.4 Select For Update

Select for update will be used when one or more of the selected rows will be updated.

2.13 SQL and Dynamic SQL

2.13.1 Bind Variables

Bind variables (sometimes called Prepared Statements or Parameter Markers) will be used whenever possible. All non-dynamic SQL statements will use bind variables.

2.13.2 Context Switching

For performance reasons, switching contexts between SQL and PL/SQL execution should be minimized. Single-row queries will be placed in their own function.

2.14 Functions

2.14.1 Boolean Functions

The only valid values that may be returned from Boolean functions are 'true' and 'false'. NULL should never be returned from a Boolean function. Boolean functions may raise exceptions.

2.14.2 OUT Parameters

Functions should not contain 'OUT' parameters.

2.15 Transaction Control

Transactions will generally be managed by the calling component. Test code may contain 'commit' and 'rollback' statements, but the PL/SQL component code will not.

Confidential

TopCoder Software, Inc. 2002 Page 6

3. References

utPLSQL - http://www.oreillynet.com/pub/a/oreilly/oracle/utplsql/news/news.html Oracle PL/SQL Best Practices, Steven Feuerstein, 2001quotesdbs_dbs22.pdfusesText_28
[PDF] pl/sql examples

[PDF] pl/sql examples for practice

[PDF] pl/sql implementation

[PDF] pl/sql user's guide and reference 12c pdf

[PDF] place d'armes 78000 versailles

[PDF] place d'armes 78000 versailles frankreich

[PDF] place de la france dans l'ue

[PDF] place de la france dans le commerce international

[PDF] place de la france dans le commerce mondial

[PDF] place de la france dans le monde 2018

[PDF] place économique de la france dans le monde

[PDF] place of english as a compulsory subject in school curriculum

[PDF] placement of braille signs

[PDF] placement test vocabulary pdf

[PDF] placenta vs baby heartbeat