rspec/rules/S2541/plsql/rule.adoc

39 lines
1.0 KiB
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
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.
On the other hand, the use of ``++ROWID++`` or ``++UROWID++`` means that your SQL statement will not be portable to other SQL databases. Further, many developers are not familiar with these data types, which can make the code harder to maintain.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,sql]
2021-04-28 16:49:39 +02:00
----
SET SERVEROUTPUT ON
DECLARE
id rowid; -- Non-Compliant
universeId urowid; -- Non-Compliant
BEGIN
SELECT rowid INTO id FROM DUAL;
SELECT rowid INTO universeId FROM DUAL;
DBMS_OUTPUT.PUT_LINE('id = ' || id);
DBMS_OUTPUT.PUT_LINE('universe id = ' || universeId);
END;
/
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Use a different data type.
endif::env-github,rspecator-view[]