Introducing Objects


Object-oriented programming languages such as Java and C++ allow you to define classes. These classes act as templates from which you can create objects. Classes define attributes and methods. Attributes are used to store an object s state, and methods are used to model an object s behaviors.

With the release of the Oracle8 database, objects became available within the database. The availability of objects in the database was a major breakthrough because they enable you to define your own classes, known as object types , in the database. Like classes in Java, database object types can contain attributes and methods. Object types are also sometimes known as user -defined types.

A simple example of an object type would be a type that models a product. This object type could contain attributes for the product s name , description, price, and in the case of a product that is perishable, the number of days the product can sit on the shelves before it must be thrown away. This product object type could also contain a method that returns the sell-by date of the product, based on the shelf life of the product and the current date. Another example of an object type might be one that models a person; this object type could store attributes for the person s first name, last name, date of birth, and address. The address itself could be an object type, and it could store things like the street, city, state, and zip code. You ll see examples of object types that represent a product, person, and address in this chapter. You ll also see how to create tables from those object types and populate those tables with rows.




Oracle Database 10g SQL
Oracle Database 10g SQL (Osborne ORACLE Press Series)
ISBN: 0072229810
EAN: 2147483647
Year: 2004
Pages: 217

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net