Home » SQL & PL/SQL » SQL & PL/SQL » table with subtypes, inserting problem (Oracle 10g on windows xp)
table with subtypes, inserting problem [message #358300] Mon, 10 November 2008 11:02 Go to next message
shearer
Messages: 1
Registered: November 2008
Location: Taranto, Italy
Junior Member
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 have asked this question because i want to create relationship between tables with REF (for object model).
Re: table with subtypes, inserting problem [message #358376 is a reply to message #358300] Tue, 11 November 2008 01:10 Go to previous message
_jum
Messages: 509
Registered: February 2008
Senior Member
for example:
insert into persona(telefono) SELECT REF(e) FROM Telefono e WHERE e.cellulare = '3498282821';
Previous Topic: Need help
Next Topic: Query output - Help
Goto Forum:
  


Current Time: Wed Dec 07 10:50:37 CST 2016

Total time taken to generate the page: 0.08310 seconds