Skip to content

Commit

Permalink
Merge pull request #7 from demasy/issue#5
Browse files Browse the repository at this point in the history
Issue#5
  • Loading branch information
demasy authored Sep 16, 2022
2 parents 8c7bb2e + c18b1a6 commit d9f6f31
Show file tree
Hide file tree
Showing 10 changed files with 346 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- <a href="https://github.com/demasy/Oracle-EBS-Development-Guidelines/tree/main/customization-standards-guidelines">**Customization Standards Guidelines**</a>
- Oracle AOL Standards Guidelines
- Database Standards Guidelines
- <a href="https://github.com/demasy/Oracle-EBS-Development-Guidelines/tree/main/database-standards-guidelines">**Database Standards Guidelines**</a>
- OA Framework Standards Guidelines
- Report Standards Guidelines
- Workflow Standards Guidelines
Expand Down
78 changes: 78 additions & 0 deletions database-standards-guidelines/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Database Standards Guidelines

- <a href="#general-syntax">**General Syntax**</a>
- <a href="#general-standards">**General Standards**</a>
- <a href="#specific-database-object-types-standards">**Specific Database Object Types Standards**</a>
- Oracle PL/SQL Coding Standards

<br>

## General Syntax

> {custom_schema}{separator}{app_short_name}{separator}[Optional {prefix}{separator}]{object_name}[Optional {separator}{suffix}]
<br>

#### Syntax Elements

| SEQ | Element Syntax | Element Name | Description |
| :-: | :--- | :-- | :-------- |
| 1 | *{custom_schema}* | Custom Database Schema | Database custom ORACLE schema name |
| 2 | *{separator}* | Separator | Must use underscore “_” in database objects|
| 3 | *{app_short_name}* | Application/Product Short Name| This is the application/product short name |
| 4 | *{prefix}* | Prefix | |
| 5 | *{object_name}* | Database Object Name | |
| 6 | *{suffix}* | Suffix | |


<br>



## General Standards

- NEVER modify Oracle standard database objects.
- You must follow standard naming conventions and syntax for creating new database objects.
- The database object name `{object_name}` must be meaningful and brief.
- Do not use generic, all-purpose phrases like ”COMMON”, ”MISC”, ”OTHER”, or ”UTILITY” in the database object name `{object_name}`.
- You must use the underscore “\_” as a separator `{separator}` between each word in the database object name.
- The custom database objects must start with a custom database schema name for example "**XXD**". [^1]
- The application/product short name `{app_short_name}` is a foreign key from Oracle standard table called "FND_APPLICATIONS".
- You must create new database tables, sequences, and types, in the custom schema for example "**XXD**". [^1]
- You must create new database views and packages in the "**APPS**" schema.
- Never create new stand-alone functions and procedures. Should be implemented as part of a package.
- You must use grants and synonyms to allow other ORACLE schemas to access your custom objects and to enable your custom ORACLE ID access to Oracle Applications objects.
- Include header information when you create your objects.

<br>

###### Header Information

```SQL
/*
Name: Create & Post GL Journals
Purpose: This is the main package to create & post GL journals
Arguments
Arg1 Describe arg1
Arg2 Describe arg2
Notes
1. Special usage notes
2. Special usage notes
History
13–NOV–1986 Ahmed El-Demasy Created
*/
```
<br>

## Specific Database Object Types Standards
- <a href="https://github.com/demasy/Oracle-EBS-Development-Guidelines/tree/main/database-standards-guidelines/tables-standards">**Tables Standards**</a>
- <a href="https://github.com/demasy/Oracle-EBS-Development-Guidelines/tree/main/database-standards-guidelines/sequences-standards">**Sequences Standards**</a>
- <a href="https://github.com/demasy/Oracle-EBS-Development-Guidelines/tree/main/database-standards-guidelines/views-standards">**Views Standards**</a>
- <a href="https://github.com/demasy/Oracle-EBS-Development-Guidelines/tree/main/database-standards-guidelines/packages-standards">**Packages Standards**</a>


<br>

##### References
[^1]: "**XXD**" is the custom database ORACLE schema association to my custom application called "Demasy Custom Applications".
[^2]: This is a custom table for data upload and migrations **ONLY** and should drop these tables after the upload data process finish.
3 changes: 3 additions & 0 deletions database-standards-guidelines/appendix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Appendix
- <a href="https://github.com/demasy/Oracle-EBS-Development-Guidelines/blob/main/database-standards-guidelines/appendix/database-objects-naming-conventions.md">**Naming Conventions Syntax Elements**</a>
- <a href="https://github.com/demasy/Oracle-EBS-Development-Guidelines/blob/main/database-standards-guidelines/appendix/syntax-elements-description.md">**Database Custom Objects Naming Conventions**</a>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Database Custom Objects Naming Conventions

<br>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Naming Conventions Syntax Elements

This appendix presents naming conventions and database syntax elements and describes them.

<br>

## Syntax Elements

| SEQ | Element Syntax | Element Name | Description |
| :-: | :--- | :-- | :-------- |
| 1 | *{custom_schema}* | Custom Database Schema | Database custom ORACLE schema name |
| 2 | *{separator}* | Separator | Must use underscore “_” in database objects|
| 3 | *{app_short_name}* | Application/Product Short Name| This is the application/product short name |
| 4 | *{prefix}* | Prefix | |
| 5 | *{object_name}* | Database Object Name | |
| 6 | *{suffix}* | Suffix | |
38 changes: 38 additions & 0 deletions database-standards-guidelines/packages-standards/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Packages Standards

<br>

- Naming Syntax
- <a href="#naming-convention">**Naming Convention**</a>
- <a href="#standards">**Standards**</a>
- Examples

<br>


## Naming Convention


| SEQ | Object Name | Length | Prefix | Suffix | Example |
| :-: | :---- | :-: | :---: | :--- | :---- |
| 1 | Table Handlers Packages | 27 | - | PKG | |
| 1.1 | Insert Procedures | | INS | - | |
| 1.2 | Update Procedures | | UPD | - | |
| 1.3 | Delete Procedures | | DEL | - | |
| 1.4 | Lock Procedures | | LOCK | - | |
| 3 | Public Packages | 27 | - | API | |
| 4 | Private Packages | 27 | - | PVT | |
| 5 | Unit Testing Packages | 30 | UT | - | |

<br>

## Standards

- You MUST follow database custom objects <a href="https://github.com/demasy/Oracle-EBS-Development-Guidelines/tree/main/database-standards-guidelines">**general standards**</a>.
- You MUST place the new packages in the "**APPS**" schema.
- The packages name `{object_name}` must be 27 characters or less for table handlers packages, and end with `PKG`.
- The packages name `{object_name}` must be 27 characters or less for public packages, and end with `API`.
- The packages name `{object_name}` must be 27 characters or less for private packages, and end with `PVT`.
- The packages name `{object_name}` must be 30 characters or less for unit testing packages, and start with `UT`.

<br>
43 changes: 43 additions & 0 deletions database-standards-guidelines/plsql-coding-standards/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Oracle PL/SQL Coding Standards


<br>

- <a href="#syntax">**Syntax**</a>
- <a href="#plsql-objects-naming-convention">**PL/SQL Objects Naming Convention**</a>
- PL/SQL Objects Naming Standards

<br>


## Syntax

> {scope}{separator}[Optional {prefix}{separator}]{identifier_name}[Optional {separator}{suffix}]
<br>

## PL/SQL Objects Naming Convention

| SEQ | Object Name | Length | scope | Prefix | Suffix | Example |
| :- | :---- | :-: | :-- | :--- | :-- | :---- |
| 1 | **Variables** | - | - | - | - | - |
| 1.1 | Global Variable | | g | | | g_enterprise_id |
| 1.2 | Local Variable | | l | | | l_customer_id |
| 2 | **Constants** | - | - | - | - | - |
| 2.1 | Global Constants | | g | c | | gc_max_discount |
| 2.2 | Local Constants | | l | c | | lc_max_discount |
| 3 | **Parameters** | - | | - | - | - |
| 3.1 | Cursor Parameters | | | p | | p_customer |
| 3.2 | In Parameters | | | p | | p_customer_id |
| 3.3 | Out Parameters | | | x | | x_customer_id |
| 3.4 | In/Out Parameters | | | px | | px_customer_id |
| 4 | **Other Objects** | - | | - | - | - |
| 4.1 | Cursors | | | cur | | cur_customers |
| 4.2 | Record | | | r | type | r_customer_type |
| 4.3 | Array / Table | | | t | type | t_customers_type |
| 4.4 | Objects | | | o | type | o_customers_type |
| 4.5 | Exceptions | | | e | | e_customer_exists |
| 4.6 | Exception Number | | | en | | en_customer_exists|


<br>
33 changes: 33 additions & 0 deletions database-standards-guidelines/sequences-standards/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Sequences Standards

<br>

- Naming Syntax
- <a href="#naming-convention">**Naming Convention**</a>
- <a href="#standards">**Standards**</a>
- Examples

<br>

## Naming Convention

<br>

| SEQ | Object Name | Length | Prefix | Suffix | Example |
| :-: | :---- | :-: | :--- | :--- | :---- |
| 1 | Sequence | 30 | - | SEQ | `XXD_DOCUMENT_ID_SEQ` |


<br>


## Standards
- You MUST follow database custom objects <a href="https://github.com/demasy/Oracle-EBS-Development-Guidelines/tree/main/database-standards-guidelines">**general standards**</a>.
- The sequence name `{object_name}` should be 30 characters or less and end with `_SEQ`.
- You must place the new sequence in the custom ORACLE schema, for example, "**XXD**", and grant privileges to the "**APPS**" schema.
- Use each sequence to supply unique ID values for one column of one table.
- Do not design sequences that wrap using the CYCLE option or have limited ranges using MAXVALUE.
- Use a NUMBER datatype to store sequence values within PL/SQL.
- Do Not Use the FND_UNIQUE_IDENTIFIER_CONTROL Table.

<br>
86 changes: 86 additions & 0 deletions database-standards-guidelines/tables-standards/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Tables Standards

<br>

- <a href="#naming-syntax">**Naming Syntax**</a>
- <a href="#naming-convention">**Naming Convention**</a>
- <a href="#standards">**Standards**</a>
- <a href="#examples">**Examples**</a>

<br>

## Naming Syntax

##### Syntax

> {custom_schema}{separator}{app_short_name}{separator}[Optional {prefix}{separator}]{object_name}[Optional {separator}{suffix}]
<br>

##### Syntax for data upload tables ONLY

> {prefix}{separator}{app_short_name}{separator}{object_name}
<br>

## Naming Convention

| SEQ | Object Name | Length | Prefix | Suffix | Example |
| :-: | :---- | :-: | :--- | :--- | :---- |
| 1 | Table | 20 | - | - | XXD_PO_LC_DOCUMENTS |
| 2 | Temporary Table | 20 | - | TMP | XXD_PO_LC_DOCS_TMP |
| 3 | Data Upload Table [^1] | 20 | TMP | - | TMP_PO_LC_DOCS |

<br>

## Standards

- You MUST follow database custom objects <a href="https://github.com/demasy/Oracle-EBS-Development-Guidelines/tree/main/database-standards-guidelines">**general standards**</a>.
- The table name `{object_name}` should be plural.
- The table name `{object_name}` should be 20 characters or less. It can be longer, but you need to abbreviate it for the table handler package name, which must be 27 characters or less.
- You must place the new tables in the custom ORACLE schema, for example, "**XXD**", and grant privileges to the "**APPS**" schema.
- You must create private synonyms for custom tables in "**APPS**" schema.
- The table MUST include a primary key (PK) column and supply value from a specific sequence.
- You should add special WHO columns to your tables.
- You should add concurrent program WHO columns to your table.
- You should add descriptive flexfield (DFF) attribute columns to your table.
- New tables containing flexfield or Oracle Alert columns must be registered with Oracle Application Object Library (AOL).
- You should register your custom tables with Oracle AOL using the table registration API called "**AD_DD**".
- `AD_DD.REGISTER_TABLE`
- `AD_DD.REGISTER_COLUMN`

<br>

##### WHO columns

| Column Name | Type | Null? | Foreign Key? | Value |
| :-- | :---- | :-: | :-- | :--- |
| CREATED_BY | NUMBER(15) | NOT NULL | FND_USER | TO_NUMBER (FND_ PROFILE.VALUE (’USER_ID’)) |
| CREATION_DATE | DATE | NOT NULL | | SYSDATE |
| LAST_UPDATED_BY | NUMBER(15) | NOT NULL | FND_USER | TO_NUMBER (FND_ PROFILE.VALUE (’USER_ID’)) |
| LAST_UPDATE_DATE | DATE | NOT NULL | | SYSDATE |
| LAST_UPDATE_LOGIN | NUMBER(15) | | | TO_NUMBER (FND_ PROFILE.VALUE (’LOGIN_ ID’)) |

<br>

##### Concurrent Program WHO Columns

| Column Name | Type | Null? | Foreign Key to Table? |
| :-- | :---- | :-: | :-- |
| REQUEST_ID | NUMBER(15) | | FND_CONCURRENT_REQUESTS |
| PROGRAM_APPLICATION_ID | NUMBER(15) | | FND_CONCURRENT_PROGRAMS |
| PROGRAM_ID | NUMBER(15) | | FND_CONCURRENT_PROGRAMS |
| PROGRAM_UPDATE_DATE | DATE | | ROGRAM_UPDATE_DATE |

<br>

## Examples

| Better | Bad |
| :--- | :--- |
| - `XXD_PO_LC_DOCUMENTS` | - `XXD_PO_LC_DOCUMENT` <br> - `PO_LC_DOCUMENTS` |

<br>

##### References
[^1]: This is a custom table for data upload and migrations **ONLY** and should drop these tables after the upload data process finish.
45 changes: 45 additions & 0 deletions database-standards-guidelines/views-standards/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Views Standards

<br>

- <a href="#naming-syntax">**Naming Syntax**</a>
- <a href="#naming-convention">**Naming Convention**</a>
- <a href="#standards">**Standards**</a>
- <a href="#examples">**Examples**</a>

<br>

## Naming Syntax

> {custom_schema}{separator}{app_short_name}{separator}[Optional {prefix}{separator}]{object_name}[Optional {separator}{criteria}][Optional {separator}{suffix}]

<br>

## Naming Convention

| SEQ | Object Name | Length | Prefix | Suffix | Example |
| :-: | :---- | :-: | :---: | :--- | :---- |
| 1 | Views | 30 | - | V | `XXD_PO_LC_DOCUMENTS_V` |
| 2 | Materialized Views | 30 | - | MV | `XXD_PO_LC_DOCUMENTS_MV` |

<br>

## Standards
- You MUST follow database custom objects <a href="https://github.com/demasy/Oracle-EBS-Development-Guidelines/tree/main/database-standards-guidelines">**general standards**</a>.
- The view name `{object_name}` should be 30 characters or less and end with "**V**" for view and "**VM**" for materialized views.
- The first column your view should select is the ROWID for the root table, and the view should alias it to "**ROW_ID**".
- You only need to include the ROWID column if an Oracle Forms block is based on this view.

<br>

## Examples

<br>

| Better | Bad |
| :--- | :--- |
| - `XXD_PER_EMPLOYEE_INFO_V` <br> - `XXD_PO_ORDERS_APPROVED_V` <br> - `XXD_PO_ORDERS_REJECTED_V` <br> - `XXD_INV_ALL_ITEMS_MV` | - `PER_EMPLOYEE_INFO_V` <br> - `XXD_HR_EMPLOYEE_INFO_V` <br> - `XXD_PO_ORDERS_REJECTED`|

<br>

0 comments on commit d9f6f31

Please sign in to comment.