Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Object Table
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
![]() |
![]() |