Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Object Table
Originally posted by Jiraiya Sama
> 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.
The correct and best way is not to create tables based on object types at all (IMHO I suppose I should say). The most experienced database designers don't, which is probably why you haven't received any answer to your question yet.
-- Posted via http://dbforums.comReceived on Wed Aug 27 2003 - 07:47:52 CDT
![]() |
![]() |