With the SUBTYPE statement, PL/SQL allows you to define your own subtypes or aliases of predefined datatypes, sometimes referred to as abstract datatypes.
There are two kinds of subtypes.
Ø Constrained
Ø Unconstrained
CONSTRAINED SUBTYPE
A subtype that restricts or constrains the values normally allowd by the datatype itself.
Ex:
Subtype positive is binary_integer range 1..2147483647;
In the above declaration a variable that is declared as positive can store only ingeger greater than zero even though binary_integer ranges from -2147483647..+2147483647.
UNCONSTRAINED SUBTYPE
A subtype that does not restrict the values of the original datatype in variables declared with the subtype.
Ex:
Subtype float is number;
No comments:
Post a Comment