Home
Variables and columns should not be self-assigned
Description
The rule "Variables and columns should not be self-assigned" in PL/SQL code means that variables and columns should not be assigned to themselves. This is a best practice to follow in order to avoid errors and confusion. Self-assigning variables and columns can lead to unexpected results, and can be difficult to debug. It is best to assign variables and columns to other values or results from other operations.
Key Benefits
- Ensures Data Integrity: Variables and columns should not be self-assigned to ensure that data is consistent and accurate.
- Reduces Errors: By avoiding self-assignment of variables and columns, errors can be reduced and data can be more reliable.
- Improves Data Quality: By following this rule, data quality can be improved as data is more consistent and accurate.
- Increases Efficiency: Following this rule can help to increase efficiency as data entry and processing is more streamlined.
Non-compliant Code Example
UPDATE CUSTOMERS
SET City=City --Non compliant code (Self assigned column)
WHERE Id = customerId
Compliant Code Example
UPDATE CUSTOMERS
SET City=p_city --Compliant code
WHERE Id = customerId