G-2190
🆓Error
Avoid using ROWID or UROWID.
Reason
Be careful about your use of Oracle Database specific data types like rowid
and urowid
. They might offer a slight improvement in performance over other means of identifying a single row (primary key or unique index value), but that is by no means guaranteed.
Use of rowid
or urowid
means that your SQL statement will not be portable to other SQL databases. Many developers are also not familiar with these data types, which can make the code harder to maintain.
Example
Non-Compliant Example
declare l_department_name departments.department_name%type; l_rowid rowid; begin update departments set department_name = l_department_name where rowid = l_rowid; end; /
Issues
Line | Column | Message |
---|---|---|
7 | 11 |
★★★★★
Compliant Solution -
declare l_department_name departments.department_name%type; l_department_id departments.department_id%type; begin update departments set department_name = l_department_name where department_id = l_department_id; end; /
References
- same as plsql:RowidAndUrowidCheck
- same as Trivadis G-2190