Re: Object oriented oracle ?

From: Steve Long <answers_at_ix.netcom.com>
Date: 1996/06/04
Message-ID: <4p1vdv$sak_at_sjx-ixn3.ix.netcom.com>#1/1


Ken,

The answer you are looking for depends on the extent to which the database is used soley as persistent storage vs is it used for a logic/rules engine. As some replies have indicated, PL/SQL support object based implementations. My own experience is that the RDBMS is used as a repository for persistent storage, not as a methods engine.

The key distinction to keep in mind between OO and functional systems is that (theoretically) an object is both methods and data in a single entity (the object), where as funtional has a clear distinction between methods (functions and procedures) and the data (usually in the RDBMS), with parameters used between methods.

Your challenge I would guess is to map the persistent storage into a relational model. This is non-trivial, but doable (I have done it numerous times). However, the topic is too lengthy to address in this email. Keep in mind usually a sinle object becomes multiple tables with foreign keys.

Steve
804-262-6332


In <31AFC77C.3033_at_mail.tapestry.com> Ken Johnson <ken.johnson_at_mail.tapestry.com> writes:
>
>95donakanti_at_wmich.edu wrote:
>>
>> hi,
>>
>> I am just learning oracle 7.1.
>> I'm supposed to do a Object oriented database in Oracle...
>>
>> I have been reading oracle for quite some time, and i found that
 tables,views
>> etc.. are stored as objects in oracle..
>>
>> but i was not able to understand what a object oriented
 database in
>> oracle would be...
>> if i use tables,views etc does it mean the database is object
>> oriented ?
>>
>> or, does oracle support any other object oriented tools ?
>> if it supports , what are they and how do i implement it ....
>>
>> any help is appreciated...
>>
>> thankx in advance
>>
>> RamOracle7 is a relational database not an object-oriented database.
>However, you can do some object-oriented type things (Data Hiding,
 Encapsalation(sp))
>using PL/SQL packages. Here is an example:
>
>CREATE TABLE Employee_Data
>(
> EmployeName Varchar2(50),
> StartDate Date,
> EndDate Date,
> Salary Number
>);
>
>CREATE PACKAGE Employee AS
> No_Such_Employee Exception;
> After_Hours Exception;
>
> Procedure HireEmployee(Name IN Varchar2, StartingSalary IN
 Number);
> Procedure FireEmployee(Name IN Varchar2);
> Procedure ChangeSalary(Name IN Varchar2, NewSalary IN Number);
> Function GetSalary(Name IN Varchar2) RETURN Number;
>END;
>/
>
>CREATE PACKAGE BODY Employee AS
> -- This procedure is private (because it isnt listed in the Package
 Spec above
>
> Procedure CheckHours IS
> Hour Number;
> BEGIN
> Hour := TO_Number(TO_CHAR(Sysdate, 'hh24'));
>
> IF (Hour < 8 OR Hour > 17) THEN
> Raise After_Hours; -- Generate an Exception
 (Error)
> END IF;
> END;
>
> PROCEDURE HireEmployee(Name IN Varchar2, StartingSalary IN
 Number)
> BEGIN
> INSERT INTO Employee_Data
> (
> EmployeeName,
> StartDate,
> Salary
> )
> VALUES
> (
> Name,
> SysDate,
> StartingSalary
> );
> END;
>
> PROCEDURE FireEmployee(Name IN Varchar2)
> BEGIN
> null;
> END;
>
> PROCEDURE ChangeSalary(Name IN Varchar2, NewSalary IN Number)
> BEGIN
> null;
> END;
>
> Function GetSalary(Name IN Varchar2) RETURN Number IS
> SalaryTemp Number;
> BEGIN
> SELECT Salary INTO SalaryTemp
> FROM Employee_Data
> WHERE EmployeeName = Name;
> WHEN No_Data_Found THEN
> Raise No_Such_Employee;
> END;
>END;
>/
>GRANT EXECUTE ON EMPLOYEE to PERSONELL;
>
>Then users with the PERSONELL role would only be able to manipulate
 the
>EMPLOYEE_DATA through the methods you allow in the package.
>
>--
>-------------------------------------------------
>Ken Johnson - Technical Consultant
>Tapestry Computing, Inc. http://www.tapestry.com
Received on Tue Jun 04 1996 - 00:00:00 CEST

Original text of this message