Skip to content

Commit 12e0ba6

Browse files
authored
Update README.md
1 parent 08baaa0 commit 12e0ba6

File tree

2 files changed

+135
-1
lines changed
  • Oracle-SQL-and-PL-SQL-Coding-Guidelines
  • Oracle-SQL-and-PL-SQL-Coding-Guidelines

2 files changed

+135
-1
lines changed

Oracle-SQL-and-PL-SQL-Coding-Guidelines /README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# **Oracle SQL and PL/SQL Coding Guidelines**
2+
3+
The main purpose of **Oracle SQL and PL/SQL Coding Guidelines** to define the standards and guidelines for Oracle PL/SQL developers. These guidelines will be maintained and reviewed frequently to improve it and reach the best practices to write, maintain and enhancement the Oracle SQL and Pl/SQL by **@EgyptianProgrammers** community.
4+
5+
## Oracle SQL and PL/SQL Coding Guidelines
6+
7+
1. **Introduction**
8+
- Overview
9+
2. **Naming Conventions**
10+
- Oracle Database Objects
11+
- Oracle PL/SQL Objects
12+
- File Extensions
13+
14+
## Introduction
15+
16+
The main purpose of Oracle SQL and PL/SQL Coding Guidelines to define the standards and guidelines for Oracle PL/SQL developers.These guidelines will be maintained and reviewed frequently to improve it and reach the best practices to write, maintain and enhancement the Oracle SQL and Pl/SQL.
17+
18+
**Naming Convention** In computer programming, a naming convention is a set of rules for choosing the character sequence to be used for identifiers which denote variables, types, functions, and other entities in source code and documentation.
19+
</br>
20+
<b>Reference: </b><a href="https://en.wikipedia.org/wiki/Naming_convention_(programming)"> wikipedia</a>
21+
22+
## Naming Conventions
23+
This is the Egyptian programmers naming conventions for Oracle database objects and PL/SQL code.
24+
25+
### Oracle Database Objects
26+
This is the standard of oracle database objects
27+
<br>
28+
##### Syntax
29+
30+
> **[optional {module_abbr}{separator}]{prefix}{separator}{identifier_name}{separator}{suffix}**
31+
32+
> Notes: **pos** is abbreviation or short for **P**oint **O**f **S**ale, and we will use it as module abbreviation for example.
33+
34+
| SEQ | Object Name | Length | Prefix | Suffix | Example |
35+
| :- | :---- | :-: | :--- | :--- | :---- |
36+
| 1 | **Tables** | - | - | - | -|
37+
| 1 | Table | 30 | | | customers, customer_headers and pos_customer_headers |
38+
| 1 | Temporary Table | 30 | | _tmp |customers_update_tmp|
39+
| 1.1 | **Table Constraints** | - | - | - | - |
40+
| 1.1.1 | Primary Key | | | _pk | customer_id_pk |
41+
| 1.1.2 | Foreign Key | | | _fk | customer_id_fk |
42+
| 1.1.3 | Check | | | _ck | customer_mobile_ck |
43+
| 1.1.4 | Unique Key | | | _uk | customer_mobile_uk |
44+
|1.1.5 | Index | 30 | | _idx | customer_id_idx |
45+
| 2 | Views | 30 | | _v | customers_v, customer_headers_v and pos_customer_headers_v |
46+
| 3 | Materialized Views | 30 | | _mv |customers_mv, customer_headers_mv and pos_customer_headers_mv |
47+
| 4 | **Packages** | - | - | - | - |-|
48+
| 4.1 | Packages: Table Handlers | 30 | | _pkg | customer_headers_pkg |
49+
| 4.1.1 | Insert Procedures | 30 |ins_ | | ins_customer |
50+
| 4.1.2 | Update Procedures | 30 |upd_ | | upd_customer |
51+
| 4.1.3 | Delete Procedures | 30 |del_ | | del_customer |
52+
| 4.2 | Public Packages | 30 | | _api | customer_headers_api |
53+
| 4.3 | Private Packages | 30 | | _pvt | customer_headers_pvt |
54+
| 4.4 | Wrapped Packages | 30 | | _wrap | customer_headers_wrap |
55+
| 4.5 | Procedures | 30 | | | transfer_customer |
56+
| 4.6 | Functions | 30 | | | get_customer_name |
57+
| 5 | Standalone Procedures | 30 | | | transfer_customer_proc |
58+
| 6 | Standalone Functions | 30 | | | get_customer_name_func |
59+
| 7 | Sequences | 30 | | _seq | customer_id_seq |
60+
| 8 | Synonyms | 30 | | | |
61+
| 9 | Triggers | 30 | | _trg | concate_cutomer_name_trg |
62+
| 10 | Directories | 30 | | _dir | customer_accounts_dir |
63+
| 11 | Context | 30 | | _con | customer_accounts_con |
64+
| 12 | Collection Types | - | | - | - |
65+
| 12.1 | Arrays | | r_ | _type | r_customer_type |
66+
| 12.2 | Tables | | t_ | _type | t_customer_type |
67+
| 12.3 | Objects | | o_ | _type | o_customer_type |
68+
69+
70+
### Oracle PL/SQL Objects
71+
This is the standard of oracle PL/SQL objects.
72+
##### Syntax
73+
74+
> **{scope}{prefix}{separator}{identifier_name}{separator}{suffix}**
75+
76+
| SEQ | Object Name | Length | scope | Prefix | Suffix | Example |
77+
| :- | :---- | :-: | :-- | :--- | :-- | :---- |
78+
| 1 | **Variables** | | | | | |
79+
| 1.1 | Global Variable | | g | _ | | g_enterprise_id |
80+
| 1.2 | Local Variable | | l | _ | | l_customer_id |
81+
| 2 | **Constants** | | | | | |
82+
| 2.1 | Global Constants | | g | c | | gc_max_discount |
83+
| 2.2 | Local Constants | | l | c | | lc_max_discount |
84+
| 3 | **Parameters** | - | | - | - | - |
85+
| 3.1 | Cursor Parameters | | | p | | p_customer |
86+
| 3.2 | In Parameters | | | p | in | p_customer_in |
87+
| 3.3 | Out Parameters | | | p | out | p_customer_out |
88+
| 3.4 | In/Out Parameters | | | p | inout | p_customer_inout |
89+
| 4 | **Other Objects Definitions** | - | | - | - | - |
90+
| 4.1 | Cursors | | | cur | | cur_customers |
91+
| 4.2 | Record | | | r | type | r_customer_type |
92+
| 4.3 | Array / Table | | | t | type | t_customers_type |
93+
| 4.4 | Objects | | | o | type | o_customers_type |
94+
| 4.5 | Exceptions | | | e | | e_customer_exists |
95+
| 4.6 | Exception Number | | | en | | en_customer_exists|
96+
97+
</br> </br>
98+
<h2>File Extensions</h2>
99+
Stay Tuned Stay Tuned Stay Tuned Stay Tuned Stay Tuned Stay Tuned Stay Tuned Stay Tuned Stay Tuned Stay Tuned Stay Tuned Stay Tuned Stay Tuned Stay Tuned :)
100+
101+
| SEQ | Object Name | Extension | Example | Remarks |
102+
| :-: | :--- | :--- | :--- | :-------- |
103+
| 1 | **Package** |
104+
| 1.1 | Package Specification | .pks | customer_headers_api.pks | |
105+
| 1.2 | Package Body | .pkb | customer_headers_api.pkb | |
106+
| 2 | Everything else | .sql | customer_headers.sql | |
107+
108+
109+
</br>
110+
111+
## Appendix
112+
The appendix section that presents elements syntax and describes it.
113+
114+
| SEQ | Element Syntax | Element Name. | Description |
115+
| :-: | :--- | :-- | :-------- |
116+
| 1 | {separator} | Separator | |
117+
| 2 | {scope} | Scope | |
118+
| 3 | {identifier_name} | Identifier Name | |
119+
| 4 | {module_name} | Module* Name | |
120+
| 5 | {module_abbr} | Module Name | |
121+
| 6 | {table_name} | Table Name | |
122+
| 7 | {table_abbr} | Table Abbreviation | |
123+
| 8 | {column_name} | Column Name | |
124+
| 9 | {column_abbr} | Column Abbreviation | |
125+
126+
*Module
127+
128+
## Glossary
129+
> Soon
130+
131+
## References
132+
> Soon
133+
134+
###### Contact US
135+
> If you have any further questions, please don’t hesitate to contact me e-mail: **info@egyptianprogrammers.com**

0 commit comments

Comments
 (0)