|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Using
abstract data types in Oracle One of the shortcomings
of Oracle7 databases was the inability to model grouped data columns. For
example, if we want to select all of the address information for a
customer, we are required to select and manipulate street_address,
city_address, and zip_code as three separate column statements in our SQL.
With abstract data typing, we can create a new datatype called
full_mailing_address_type, and manipulate it as if it were an atomic
datatype. Fortunately, Oracle8
allows us to do the same type of grouping with their new create type
syntax. CREATE
OR REPLACE TYPE full_mailing_address_type AS OBJECT Once defined, we can
treat full_mailing_address_type as a valid datatype and use it to create
tables. CREATE
TABLE Now that the Oracle
table is defined, we can reference full_mailing_address_type in our SQL
just as if it were a primitive datatype: insert
into SQL>
select * from customer; If you like Oracle
tuning, you might enjoy my latest book “Oracle Tuning: The DefinitiveReference” by Rampant TechPress. (I don’t think
it is right to charge a fortune for books!) and you can buy it right now
at this link: http://www.rampant-books.com/book_1002_oracle_tuning_definitive_reference_2nd_ed.htm
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||