Re: table with subtypes, inserting problem

From: Shearer <>
Date: Mon, 10 Nov 2008 17:22:27 GMT
Message-ID: <n5_Rk.100791$>

My question was for an university exam, thanks for your hints. The book of Tom Kyte is free online? I have not found it

gym dot scuba dot kennedy at gmail wrote:

> "Shearer" <> wrote in message
> news:V%YRk.189724$

>>I have asked this question because i want to create relationship between
>> tables with REF (for object model).
>> Shearer wrote:
>>> create or replace type IndirizzoTY as object
>>> (via varchar(30),
>>> comune varchar(20),
>>> provincia char(2));
>>> create or replace type PersonaTY as object
>>> (cognome varchar(20),
>>> nome varchar(15),
>>> indirizzo indirizzoTY);
>>> create table Persona of PersonaTY;
>>> insert into Persona values('Insegno','Pino',IndirizzoTY('Via
>>> Dante','Roma','Rm'));
>>> create type TelefonoTY as object
>>> (abitazione varchar(12),
>>> ufficio varchar(12),
>>> cellulare varchar(12));
>>> alter type PersonaTY add attribute (telefono REF TelefonoTY) cascade;
>>> create table Telefono of TelefonoTY;
>>> insert into Telefono values('099342312','099102121','3498282821');
>>> ------------------------------------------------------------------------------------------
>>> insert into Persona
>>> select 'Smith','John'.................................
>>> How to insert values into the column "indirizzo" of Persona?

> I know you can do this in Oracle. However you may choose to have an
> object
> view and store the data in traditional manner. I use objects and
> collections quite frequently in pl/sql. I do not use them in storing
> things
> to the db. If you read Tom Kyte's first book it goes into all the little
> bits andpieces that occur in storing objects. At least at the time it
> raised some performance issues and the management of those issues more
> complex.
> My recommendation - if this is going to be a production system - is use
> standard "old" relations and have pl/sql wrappers for the programming
> language that is going to interact with the DB. (eg Java etc.) If this is
> just an experiment to increase your learning then go for it.
> Jim
Received on Mon Nov 10 2008 - 11:22:27 CST

Original text of this message