Type typBureau : <centre:char, batiment:char, numero:int>
Type typListeTelephones : collection de <entier>
Type typSpecialite : <domaine:char, specialite:char>
Type typListeSpecialites : collection de <typSpecialite>
tIntervenant (#nom:char, prenom:char, bureau:typBureau, ltelephones:typListeTelephones, lspecialites:typListeSpecialites)
CREATE OR REPLACE TYPE typBureau AS OBJECT (
centre char(2),
batiment char(1),
numero number(3)
);
/
CREATE OR REPLACE TYPE typListeTelephones AS TABLE OF number(10);
/
CREATE OR REPLACE TYPE typSpecialite AS OBJECT (
domaine varchar2(15),
technologie varchar2(15)
);
/
CREATE OR REPLACE TYPE typListeSpecialites AS TABLE OF typSpecialite;
/
CREATE TABLE tIntervenant (
pknom varchar2(20) PRIMARY KEY,
prenom varchar2(20) NOT NULL,
bureau typBureau,
ltelephones typListeTelephones,
lspecialites typListeSpecialites
)
NESTED TABLE ltelephones STORE AS tIntervenant_nt1,
NESTED TABLE lspecialites STORE AS tIntervenant_nt2;
INSERT INTO tIntervenant (pknom, prenom, bureau, ltelephones, lspecialites)
VALUES (
'Crozat',
'Stéphane',
typBureau('PG','K',256),
typListeTelephones (0687990000,0912345678,0344231234),
typListeSpecialites (typSpecialite ('BD','SGBDR'), typSpecialite('Doc','XML'), typSpecialite('BD','SGBDRO'))
);
INSERT INTO tIntervenant (pknom, prenom, bureau, ltelephones, lspecialites)
VALUES (
'Vincent',
'Antoine',
typBureau('R','C',123),
typListeTelephones (0344231235,0687990001),
typListeSpecialites (typSpecialite ('IC','Ontologies'), typSpecialite('BD','SGBDRO'))
);
SELECT pknom, prenom, i.bureau.centre FROM tIntervenant i;
PKNOM PRENOM BUREAU.CENTRE
-------------------- -------------------- -------------
Crozat Stéphane PG
Vincent Antoine R
SELECT i.pknom, t.*
FROM tIntervenant i, TABLE(i.ltelephones) t
PKNOM COLUMN_VALUE
-------------------- ------------
Crozat 687990000
Crozat 912345678
Crozat 344231234
Vincent 344231235
Vincent 687990001
SELECT i.pknom, s.*
FROM tIntervenant i, TABLE(i.lspecialites) s
PKNOM DOMAINE TECHNOLOGIE
-------------------- --------------- ---------------
Crozat BD SGBDR
Crozat Doc XML
Crozat BD SGBDRO
Vincent IC Ontologies
Vincent BD SGBDRO