PLSQL Naming Convention

Today I will clarify how to standardize naming convention at PLSQL that may differ from one to another but I will present my view that I believe it is the most suitable to make your code more readable.
I want the post to be shortly so I will enter the subject directly by summarizing in the following table.

Type of Element                                                    Naming Convention                               Example
the first four points refer to scope

1-Local Variable                                                       lv_<identifier>                                          lv_counter
2-Local Constant                                                      lc_<indentifier>                                        lc_rate
3-global Variable (package specification variables)    gv_<indentifier>                                        gv_max_rate
4-global Constant(package specification Constants)  gc_<indentifier>                                        gc_rate

I will use 'SC' in the following to refer to scope as explained above
5-Explicit Cursor                                                      sc_<identifier>_cur                                   l_emp_cur
6-Cursor variables                                                    sc_<identifier>_cv                                    l_empno_cv
7-Record types                                                         sc_<identifier>_rt                                     l_emp_rt
8-Collection(Nested Table)                                       sc_<identifier>nt                                       l_depts_nt
9-Collection(Varray)                                                 sc_<identifier>vat                                     l_depts_vat
10-Collection(Associative Array)                              sc_<identifier>aat                                     l_depts_aat
11-Object Type                                                        sc<identifier>ot                                         l_dept_ot
12-In Parameters                                                      in_<identifier>                                          in_empcode
13-Out parameters                                                   out_<identifier>                                        out_empcode
14-In Out parameters                                               io<identifier>                                            io_empcode

You must comment your code to be English like and comment before every signature of function or procedure like the following
/*Procedure Purpose : XXXXXXXX
/*Author Name         : XXXXXXXX
/*Creation Date        : XXXXXXXX
/*Modify Date          : XXXXXXXX   -   Reason of modification
/*$parameters          :
/*                 par1 : xxxxx
/*                 parn : xxxxx
/*Function Output : XXXXXXXXXX
By previous comment you doesn't dig into code to know purpose of procedure.

At the end you may like my naming convention or not, So you must use what you like.

I hope that post is useful and helpful
Mahmoud Ahmed El-Sayed

Popular posts from this blog

ADF : Get Current Logged User Name

OAF : Get Current Row in Table

ADF : Working with ViewCriteria