The case of PL/SQL programming specification
As in SQL, Pl/sql is case-insensitive. Its general guidelines are as follows:
Keywords (BEGIN, EXCEPTION, end, IF THEN else,loop, End LOOP), data type (VARCHAR2, number), internal functions (least, SUBSTR), and user-defined subroutines (procedures, functions,packages), using uppercase.
Variable names, as well as column and table names in SQL, using lowercase.
Second, the PL/SQL programming specification blank
Whitespace (blank lines and spaces) is as important in pl/sql as it is in SQL, because it is an important factor in improving the readability of your code. In other words, you can manifest the logical structure of your program by using indentation in your code. Here are some suggestions:
Leave a space at the left and right of the equals sign or comparison operator;
The structure words (DECLARE, BEGIN, EXCEPTION, end,if and End IF, loop and end loop) are arranged left. In addition, nested structures in the structure are indented three spaces (using the SPACEBAR instead of the TAB key);
The main code segment is separated by a blank line;
Separate the different logical parts of the same structure on separate lines, even if the structure is short. For example, if and then are placed on the same line, and else and end if are placed on separate lines.
III. naming convention for PL/SQL programming specifications
Using the following prefix is helpful for avoiding conflicts with keywords and table names:
V_ variable Name
CON_ constant Name
I_ input parameter name, o_ output parameter name, Io_ input and output parameter name
C_ cursor name or cursor name _cur
RC_ REF cursor Name
R_record name or record name _rec
For R_stud in C_stud LOOP ...
For Stud_rec in Stud_cur loop
Type_ name, name _type (user-defined type)
T_ table name, table name _tab (pl/sql table)
Rec_record name, record name _rec (record variable)
E_ exception Name (user-defined exception)
The name of the package should describe the main functions of stored procedures and functions within the package
The name of the stored procedure should describe the action performed by the stored procedure
The name of the function should describe the returned variable