G-2170
🆓Warning
Never overload variables.
Reason
The readability of your code will be higher when you do not overload variables.
Example
Non-Compliant Example
begin
<<main>>
declare
l_variable user_objects.object_name%type := 'test_main';
begin
<<sub>>
declare
l_variable user_objects.object_name%type := 'test_sub';
begin
sys.dbms_output.put_line(l_variable
|| '-'
|| main.l_variable);
end sub;
end main;
end;
/Issues
| Line | Column | Message |
|---|---|---|
| 8 | 10 |
Compliant Solution - ★★★★★
begin
<<main>>
declare
l_main_variable user_objects.object_name%type := 'test_main';
begin
<<sub>>
declare
l_sub_variable user_objects.object_name%type := 'test_sub';
begin
sys.dbms_output.put_line(l_sub_variable
|| '-'
|| l_main_variable);
end sub;
end main;
end;
/References
- same as plsql:S1117
- same as Trivadis G-2170
- same as plsqlopen:VariableHiding