Subtypes

A subtype is a data type that gets evolved from an existing scalar data type. The purpose of creating subtypes, though not mandatory, is to customize the primary data types by controlling certain features such as nullability, range, or sign. An unconstrained subtype is often used in place of primary data types to maintain application standards.

The subtype inherits the behavior of its parent base type and extends it further by a distinguishing feature. For example, NATURALN is a subtype of BINARY_INTEGER, which prevents the entry of nulls and negative values. Similarly, SIGNTYPE permits only three fixed values: -1, 0, or 1.

The following table shows the base types and subtypes under each scalar data type:

Number

Character

Date/Time

Get Advanced Oracle PL/SQL Developer's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.