G-1060
🆓Error
Avoid storing ROWIDs or UROWIDs in database tables.
Reason
It is an extremely dangerous practice to store rowid
's in a table, except for some very limited scenarios of runtime duration. Any manually explicit or system generated implicit table reorganization will reassign the row's rowid
and break the data consistency.
Instead of using rowid
for later reference to the original row one should use the primary key column(s).
Example
Non-Compliant Example
begin insert into employees_log ( employee_id ,last_name ,first_name ,rid ) select employee_id ,last_name ,first_name ,rowid from employees; end; /
Issues
Line | Column | Message |
---|---|---|
11 | 11 |
★★★★★
Compliant Solution -
begin insert into employees_log ( employee_id ,last_name ,first_name ) select employee_id ,last_name ,first_name from employees; end; /
References
- similar to plsql:RowidAndUrowidCheck
The scope of plsql:RowidAndUrowidCheck is not limited to storing ROWIDs and UROWIDs.
- same as Trivadis G-1060