declare
subtype newSubtype is standardType [NOT NULL];
You can create subtypes in the declaration portions of procedures, functions, anonymous blocks, packages, or package bodies.
create or replace package pkg_global
is
subtype large_string is VARCHAR2(2000);
subtype medium_string is VARCHAR2(256);
subtype small_string is VARCHAR2(10);
subtype flag_yn is VARCHAR2(1) not null;
end;
/
Referencing Subtypes
SQL>
SQL> declare
2 v_medium_tx pkg_global.medium_string;
3 v_small_tx pkg_global.small_string := 'ABC';
4 v_flag_yn pkg_global.flag_yn :='N';
5 begin
6 v_medium_tx:=v_small_tx||'-'||v_flag_yn;
7 end;
8 /
PL/SQL procedure successfully completed.
SQL>
SQL>