G-2120: Try to have a single location to define your types.

Minor

Changeability

Reason

Single point of change when changing the data type. No need to argue where to define types or where to look for existing definitions.

A single location could be either a type specification package or the database (database-defined types).

Example (bad)

1
2
3
4
5
6
7
8
9
create or replace package body my_package is
   procedure my_proc is
      subtype big_string_type is varchar2(1000 char);
      l_note big_string_type;
   begin
      l_note := some_function();
   end my_proc;
end my_package;
/

Example (good)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
create or replace package types is
   subtype big_string_type is varchar2(1000 char);
end types;
/

create or replace package body my_package is
   procedure my_proc is
      l_note types.big_string_type;
   begin
      l_note := some_function();
   end my_proc;
end my_package;
/