Home

ROWID and UROWID data types should not be used

Description

    The rule "ROWID and UROWID data types should not be used" states that the ROWID and UROWID data types should not be used in PL/SQL code. These data types are used to store the physical address of a row in a database table, and are not intended to be used in PL/SQL code. Using these data types can lead to unexpected results, and should be avoided.

Key Benefits

  • Ease of use: ROWID and UROWID data types are not as easy to use as other data types, making them difficult to use in certain applications.
  • Performance: ROWID and UROWID data types can be slower than other data types, resulting in slower query performance.
  • Security: ROWID and UROWID data types can be vulnerable to security exploits, making them a poor choice for sensitive data.

 

Non-compliant Code Example

DECLARE
   first_name varchar2;
   customer_id ROWID;                       --Non compliant code (ROWID data type is used)
BEGIN
	UPDATE CUSTOMERS 
	SET FIRSTNAME = first_name
	WHERE ROWID = customer_id;
END;

Compliant Code Example

DECLARE
   first_name varchar2;
   customer_id INTEGER;                     --Compliant code 
BEGIN
	UPDATE CUSTOMERS 
	SET FIRSTNAME = first_name
	WHERE ROWID = customer_id;
END;
Visual Expert 2024
 VEPLSQLRULE153