Skip to content

G-2210: Avoid declaring NUMBER variables, constants or subtypes with no precision.

Minor

Efficiency

Reason

If you do not specify precision number is defaulted to 38 or the maximum supported by your system, whichever is less. You may well need all this precision, but if you know you do not, you should specify whatever matches your needs.

Example (bad)

1
2
3
4
5
6
7
8
9
create or replace package body constants_up is
   co_small_increase constant number := 0.1;

   function small_increase return number is
   begin
      return co_small_increase;
   end small_increase;
end constants_up;
/

Example (good)

1
2
3
4
5
6
7
8
9
create or replace package body constants_up is
   co_small_increase constant number(5,1) := 0.1;

   function small_increase return number is
   begin
      return co_small_increase;
   end small_increase;
end constants_up;
/