G-2190: Avoid using ROWID or UROWID.

Major

Portability, Reliability

Reason

Be careful about your use of Oracle-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 (bad)

1
2
3
4
5
6
7
8
9
declare
   l_department_name department.department_name%type;
   l_rowid rowid;
begin
   update department 
      set department_name = l_department_name
    where rowid = l_rowid;
end;
/

Example (good)

1
2
3
4
5
6
7
8
9
declare
   l_department_name  department.department_name%type;
   l_department_id    department.department_id%type;
begin
   update department 
      set department_name = l_department_name
    where department_id = l_department_id;
end;
/