diff --git a/README.md b/README.md index 96be5cf..696a2d5 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ - **Customization Standards Guidelines** - Oracle AOL Standards Guidelines -- Database Standards Guidelines +- **Database Standards Guidelines** - OA Framework Standards Guidelines - Report Standards Guidelines - Workflow Standards Guidelines diff --git a/database-standards-guidelines/README.md b/database-standards-guidelines/README.md new file mode 100644 index 0000000..9c51830 --- /dev/null +++ b/database-standards-guidelines/README.md @@ -0,0 +1,78 @@ +# Database Standards Guidelines + +- **General Syntax** +- **General Standards** +- **Specific Database Object Types Standards** +- Oracle PL/SQL Coding Standards + +
+ +## General Syntax + +> {custom_schema}{separator}{app_short_name}{separator}[Optional {prefix}{separator}]{object_name}[Optional {separator}{suffix}] + +
+ +#### 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 | | + + +
+ + + +## 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. + +
+ +###### 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 +*/ +``` +
+ +## Specific Database Object Types Standards +- **Tables Standards** +- **Sequences Standards** +- **Views Standards** +- **Packages Standards** + + +
+ +##### 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. diff --git a/database-standards-guidelines/appendix/README.md b/database-standards-guidelines/appendix/README.md new file mode 100644 index 0000000..3085f7a --- /dev/null +++ b/database-standards-guidelines/appendix/README.md @@ -0,0 +1,3 @@ +# Appendix +- **Naming Conventions Syntax Elements** +- **Database Custom Objects Naming Conventions** diff --git a/database-standards-guidelines/appendix/database-objects-naming-conventions.md b/database-standards-guidelines/appendix/database-objects-naming-conventions.md new file mode 100644 index 0000000..045de6e --- /dev/null +++ b/database-standards-guidelines/appendix/database-objects-naming-conventions.md @@ -0,0 +1,3 @@ +# Database Custom Objects Naming Conventions + +
diff --git a/database-standards-guidelines/appendix/syntax-elements-description.md b/database-standards-guidelines/appendix/syntax-elements-description.md new file mode 100644 index 0000000..331576e --- /dev/null +++ b/database-standards-guidelines/appendix/syntax-elements-description.md @@ -0,0 +1,16 @@ +# Naming Conventions Syntax Elements + +This appendix presents naming conventions and database syntax elements and describes them. + +
+ +## 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 | | diff --git a/database-standards-guidelines/packages-standards/README.md b/database-standards-guidelines/packages-standards/README.md new file mode 100644 index 0000000..694b92c --- /dev/null +++ b/database-standards-guidelines/packages-standards/README.md @@ -0,0 +1,38 @@ +# Packages Standards + +
+ +- Naming Syntax +- **Naming Convention** +- **Standards** +- Examples + +
+ + +## 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 | - | | + +
+ +## Standards + +- You MUST follow database custom objects **general standards**. +- 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`. + +
diff --git a/database-standards-guidelines/plsql-coding-standards/README.md b/database-standards-guidelines/plsql-coding-standards/README.md new file mode 100644 index 0000000..5d8e9d1 --- /dev/null +++ b/database-standards-guidelines/plsql-coding-standards/README.md @@ -0,0 +1,43 @@ +# Oracle PL/SQL Coding Standards + + +
+ +- **Syntax** +- **PL/SQL Objects Naming Convention** +- PL/SQL Objects Naming Standards + +
+ + +## Syntax + +> {scope}{separator}[Optional {prefix}{separator}]{identifier_name}[Optional {separator}{suffix}] + +
+ +## 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| + + +
diff --git a/database-standards-guidelines/sequences-standards/README.md b/database-standards-guidelines/sequences-standards/README.md new file mode 100644 index 0000000..2b64871 --- /dev/null +++ b/database-standards-guidelines/sequences-standards/README.md @@ -0,0 +1,33 @@ +# Sequences Standards + +
+ +- Naming Syntax +- **Naming Convention** +- **Standards** +- Examples + +
+ +## Naming Convention + +
+ + | SEQ | Object Name | Length | Prefix | Suffix | Example | + | :-: | :---- | :-: | :--- | :--- | :---- | + | 1 | Sequence | 30 | - | SEQ | `XXD_DOCUMENT_ID_SEQ` | + + +
+ + +## Standards +- You MUST follow database custom objects **general standards**. +- 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. + +
diff --git a/database-standards-guidelines/tables-standards/README.md b/database-standards-guidelines/tables-standards/README.md new file mode 100644 index 0000000..3589d08 --- /dev/null +++ b/database-standards-guidelines/tables-standards/README.md @@ -0,0 +1,86 @@ +# Tables Standards + +
+ +- **Naming Syntax** +- **Naming Convention** +- **Standards** +- **Examples** + +
+ +## Naming Syntax + +##### Syntax + +> {custom_schema}{separator}{app_short_name}{separator}[Optional {prefix}{separator}]{object_name}[Optional {separator}{suffix}] + +
+ +##### Syntax for data upload tables ONLY + +> {prefix}{separator}{app_short_name}{separator}{object_name} + +
+ +## 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 | + +
+ +## Standards + +- You MUST follow database custom objects **general standards**. +- 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` + +
+ +##### 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’)) | + +
+ +##### 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 | + +
+ +## Examples + + | Better | Bad | + | :--- | :--- | + | - `XXD_PO_LC_DOCUMENTS` | - `XXD_PO_LC_DOCUMENT`
- `PO_LC_DOCUMENTS` | + +
+ +##### References +[^1]: This is a custom table for data upload and migrations **ONLY** and should drop these tables after the upload data process finish. diff --git a/database-standards-guidelines/views-standards/README.md b/database-standards-guidelines/views-standards/README.md new file mode 100644 index 0000000..6340458 --- /dev/null +++ b/database-standards-guidelines/views-standards/README.md @@ -0,0 +1,45 @@ +# Views Standards + +
+ +- **Naming Syntax** +- **Naming Convention** +- **Standards** +- **Examples** + +
+ +## Naming Syntax + +> {custom_schema}{separator}{app_short_name}{separator}[Optional {prefix}{separator}]{object_name}[Optional {separator}{criteria}][Optional {separator}{suffix}] + + +
+ +## 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` | + +
+ +## Standards +- You MUST follow database custom objects **general standards**. +- 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. + +
+ +## Examples + +
+ + | Better | Bad | + | :--- | :--- | + | - `XXD_PER_EMPLOYEE_INFO_V`
- `XXD_PO_ORDERS_APPROVED_V`
- `XXD_PO_ORDERS_REJECTED_V`
- `XXD_INV_ALL_ITEMS_MV` | - `PER_EMPLOYEE_INFO_V`
- `XXD_HR_EMPLOYEE_INFO_V`
- `XXD_PO_ORDERS_REJECTED`| + +
+