When writing a stored procedure in oracle, PL/SQL there are lots of naming convention followed for writing the parameter names.
-
PROCEDURE PROC_MY_STORED_PROCEDURE (sFirstName VARCHAR2,
nId NUMBER,
oCursor REF_CURSOR)PROCEDURE PROC_MY_STORED_PROCEDURE (first_name_in VARCHAR2,
Id_in NUMBER,
o_Cursor REF_CURSOR) -
Should the local variable prefix with
lorl_and global withgorg_
Are there any other good naming convention to follow?
What are the best practices to follow.
Consistency is key to naming conventions.
It doesn’t matter so much what you use, as long as the convention is always used. After that, documentation if necessary.
That said, one convention I liked was to indicate the direction in the variable name. IE: An
INparameter would be:IN_FIRST_NAME; anOUTparameter would be:OUT_FIRST_NAME, and anIN OUTwould beIN_OUT_FIRST_NAME. Oracle has character limits (32 characters IIRC), so don’t get too crazy.