Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Object Table

Object Table

From: Jiraiya Sama <jiraiya_at_yahoo.com>
Date: Wed, 27 Aug 2003 14:23:27 +0800
Message-ID: <bihj4l$8kg$1@ftp.curtin.edu.au>


Hi,

i am learning the object-relational sql in oracle and i have some questions about that.

assume that i have two objects

emp_t (the employee type)
dept_t (department type)

so, first i do this

create type dept_t
/

create type emp_t as object (
 id number (3),
workdept ref dept_t,
)
/

create type dept_t as object (
id number (3),
mgrno ref emp_t, -- department manager employee no admrdept ref dept_t -- ID of administrative dept )
/

so, i'm wondering, because dept_t ref to emp_t and emp_t ref to dept_t, what is the correct and the best way to create object table for those two objects ?
is it like this ...

create table ordept of dept_t (

   id primary key
   admrdept references ordept
) ;

create table oremp of emp_t (

   id primary key,
   workdept references ordept
) ;

alter table ordept
add constraint fk_mgrno foreign key (mgrno) references oremp ;

thanks a lot. Received on Wed Aug 27 2003 - 01:23:27 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US