rspec/rules/S2528/plsql/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

49 lines
952 B
Plaintext

== Why is this an issue?
Declaring a ``++NUMBER++`` variable without any precision wastes memory because Oracle supports up to 38 decimal digits by default (or the maximum supported by your system, whichever is less). If you don't need that large a value, you should specify whatever matches your needs. This will save memory and provide extra integrity checking on input.
This rule also applies to some ``++NUMBER++`` subtypes as well: ``++NUMERIC++``, ``++DEC++``, and ``++DECIMAL++``.
=== Noncompliant code example
[source,sql]
----
DECLARE
var1 NUMBER; -- Noncompliant
var2 NUMERIC; -- Noncompliant
BEGIN
NULL;
END;
/
----
=== Compliant solution
[source,sql]
----
DECLARE
var1 NUMBER(9,2);
var2 NUMERIC(4,0);
BEGIN
NULL;
END;
/
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Specify the precision for this variable.
endif::env-github,rspecator-view[]