You are on page 1of 6

Notes prepared by K. Chandra Mouli (Lecturer), P.B.S.

C

1

2. The Basics of object-Relational Databases RDBMS (Relational Database Management System): A relational database is composed of many relations in the form of two-dimensional tables of rows and columns containing related tuples. A Relational Database Management System uses only its relational capabilities to manage the information stored in its database. ORDBMS (Object-Relational Database Management System) : The main objective of Object-Relational Database Management System was a to achieve the benefits of both the relational and the object model such as scalability and support for rich. The traditional oracle relational database, extended to include object oriented concepts and structures such as abstract data types, nested tables and varying arrays. OODBMS (Object-oriented Relational Database Management System): The main feature of OO programming languages are encapsulation, inheritance, and Polymorphism. An Object-oriented Relational Database whose design is based solely on object-oriented analysis and design. • Why should I use objects: OO features: Object reuse: If you write OO code, you increase the chances of reusing previously written code modules. Similarly, if you create OO database objects, you increase the chances that the database objects can be reused. Standards adherence : If you create standard objects, then you increase the chance that they will be reused. For example, if you create standard data types to use for all address, then all of the address in your database will use the same internal format. Defined access paths : For each object you can define the procedures and functions that act upon it- you can unite the data and the methods that access it. Abstract Data types : 1. Abstract data types are data types that consist of one or more subtypes. Rather than being constrained to the standard ORACLE data types of number, date, and varchar2, abstract data types can more accurately describe your data. 3. For example, an abstract data type for address may consist of following columns: Street varchar2 (50) City varchar2 (25) State char (2) Zip Number

2.

CLOB: . 3. The LOB data types available are BLOB. In an object table. the nested table may contain multiple rows. A varying array is a nested table with a limited set of rows. 2. A varying array is a set of objects. the value of an attribute in one tuple can be an entire relation. 2. Chandra Mouli (Lecturer). as suggested by the picture below.C 2 4. 3. Varying arrays also known as VARRAYS. you could create a column that uses the abstract data type for address – and thus contain the street. Abstract data types can be nested. Large objects: A large object or LOB is capable of storing large volumes of data. The size of array is limited when it is created. P. When you create a table that uses address information. In one sense. A more powerful use of object types in Oracle is the fact that the type of a column can be a table-type. That is. and zip columns that are part of that data type. When you create a varying array in a table. a collection. NLOB. BLOB: The BLOB data type is used for binary data. each with the same data type. 5. z). it’s a way of storing a one –to – many relationships with in one table. 5. 1. the array is treated as column in the main table. and BFILE. You can use abstract data types to create object tables.. city. CLOB. Nested tables : 1. the columns of the table map to the columns of the abstract data type. and can extend to 4 GB in length. they can contain references to other abstract data types. a b x x y y z z - - Varying Arrays : 4. A nested table is a collection of rows represented as a column with in the main table. like a nested table. A nested table is a table with in a table . For each record with in the main table. A varying array is.Notes prepared by K. b) has bvalues that are relations with schema (x. y. where a relation with schema (a.S.B.

Thus. the data base only maintains a pointer to the file. NCLOB: The NCLOB data type is used for store CLOB data for multi byte character sets. object vies give you the benefits of relational table storage and OO structures. 1. Nested tables and varying arrays are embedded objects . Object Views: Object views allow you to add OO concepts on top of your existing relational tables.S. city VARCHAR2(25). Chandra Mouli (Lecturer). you could have a single row is over 4 GB in length. Referenced objects are physically separate from the objects that refer to them. and NCLOB data types is stored inside the database. P. In above table two columns were defined. BFILE: BFILE is a pointer to an external file. PERSON_TY –and identified as an object via the as object clause Create type PERSON_TY as object (Name VARCHAR2 (25). This line (Name VARCHAR2 (25). References also Known as REFs are essentially pointers to row objects. 4. Thus.they are 2. CLOB. Address ADDRESS_TY). REFERENCES. Physically embedded within another object. Defines the first column of PERSON_TY’s representation The second line: . city. A “row object” is different than a “column object”.C 3 The CLOB data type stores character data and can extend to 4 GB in length. A common object Example : Four attributes named street. For example.Notes prepared by K.B. The files referenced by BFILES on exist on the operating system. zip NUMBER). you can create an abstract data type based on an existing table’s definition. The create type command is the most important command in th Object-relational database Create an abstract data type named ADDRESS_TY . state CHAR(2). state and zip Create type ADDRESS_TY as object (street VARCHAR2(50). The data for BLOB. 3.

PERSON_TY (‘NEIL MULLANE’. State CHAR (2). Address uses the ADDRESS_TY abstract data type previously created. P. you simply query that column’s values from the table : >Select Customer_ ID from customer . A customer has a Customer_ ID and all the attributes of a person (via the PERSON_TY data type) Create table CUSTOMER (Customer_ ID NUMBER. ‘FINN’. ADDRESS_TY (’57 MT PLEASANT ST’. COLUMN_NAME -------------------------------Customer_ ID PERSON DATA_TYPE -----------------------------------------NUMBER PERSON_TY Inserting Records into CUSTOMER Table: The following example. The Structure of a simple object : The following command creates a table named CUSTOMER. 1 row created Selecting from Abstract Data types: If you wanted to select the customer_ ID values from customer.Notes prepared by K. 11111))). Data_ Type From USER_TAB_COLUMNS Where Table_ Name = ‘CUSTOMER’.C 4 Address ADDRESS_TY). they are: Create type ADDRESS_TY as object (Street VARCHAR2 (50). Insert into CUSTOMER values (1. Use this query USER_TAB_COLUMNS data dictionary view to see the data types associated with each column in the CUSTOMER table: Select Column_ Name. Zip NUMBER). Chandra Mouli (Lecturer).S. Person PERSON_TY).’NH’. Defines the second column of PERSON_TY’s representation The second column. City VARCHAR2 (25).B. a record is inserted into CUSTOMER using the constructor methods for PERSON_TY and ADDRESS_TY data types. What are the columns within ADDRESS_TY according to the ADDRESS_TY definition.

>Select person . Chandra Mouli (Lecturer). street VARCHAR2(50). You try to relate each attribute to its primary key .C 5 CUSTOMER_ID ----------------------1 2 To select the street attribute of the address attribute within the person column. street from customer. In OO design. These systems employ both relation types to couple data items with procedural methods (encapsulation). you go beyond normalization and seek groups of columns that define a common object representation. state CHAR(2). P. . a CUSTOMER table may be created as : Create type CUSTOMER (Customer_ ID NUMBER primary key. Object-oriented databases employ a data model that supports object-oriented features discussed above and abstract data types. zip NUMBER). Object-oriented databases utilize the power of objectoriented programming languages to provide excellent database programming capability.S. in relational design . PERSON. city VARCHAR2(25).ADDRESS. The data in object-oriented database management systems (OODBMSs) is managed through two sets of relations.STREET ------------------------------------------57 MT PLEASANT ST 1 STEPAHEAD RD Object-Oriented Analysis and Design : When you consider adding in OO features such as abstract data types. This is similar to a primary key in the relational model.Address.B. For example. Name VARCHAR(25).your query will be. one describing the interrelations of data items and another describing the abstract relationships (inheritance).Notes prepared by K. you need to approach need to approach database design from a slightly different perspective. OO databases provide unique object identifiers (OIDs) so that the objects can be easily identified.

Chandra Mouli (Lecturer). P.Notes prepared by K.C 6 .B.S.