SQL:1999 - New Features - Data Types - Distinct User-defined Types

Distinct User-defined Types

Sometimes called just distinct types, these were introduced an optional feature (S011) to allow existing atomic types to be given a distinct meaning, allowing the type checking mechanism to detect some logical errors, e.g. accidentally adding an age to a salary. For example:

CREATE TYPE age AS INTEGER FINAL; CREATE TYPE salary AS INTEGER FINAL;

create two different and incompatible types. The SQL distinct types use name equivalence not structural equivalence like typedefs in C. It's still possible to perform compatible operations on (columns or data) of distinct types by using an explicit type CAST.

Few SQL systems support these. IBM DB2 is one those supporting them. Oracle database does not currently support them, recommending instead to emulate them by a one-place structured type.

Read more about this topic:  SQL:1999, New Features, Data Types

Famous quotes containing the words types and/or distinct:

    Our children evaluate themselves based on the opinions we have of them. When we use harsh words, biting comments, and a sarcastic tone of voice, we plant the seeds of self-doubt in their developing minds.... Children who receive a steady diet of these types of messages end up feeling powerless, inadequate, and unimportant. They start to believe that they are bad, and that they can never do enough.
    Stephanie Martson (20th century)

    Nobody of any real culture, for instance, ever talks nowadays about the beauty of sunset. Sunsets are quite old fashioned.... To admire them is a distinct sign of provincialism of temperament. Upon the other hand they go on.
    Oscar Wilde (1854–1900)