Clinique_RO.sql 1.32 KB
Newer Older
Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
1
CREATE OR REPLACE TYPE traitement AS OBJECT (
2
3
4
5
6
7
    id_traitement NUMBER,
    debut DATE,
    duree NUMBER,
    quantite NUMBER,
    veterinaire VARCHAR(30),
    medicament VARCHAR(30)
Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
8
9
10
11
);
/


12
13
14
15
16
17
18
19
CREATE OR REPLACE TYPE numero AS OBJECT(
    numero VARCHAR(12)
);
/

CREATE OR REPLACE TYPE listNumeros AS TABLE OF numero;
/

Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
20
21
22
23
CREATE OR REPLACE TYPE listTraitements AS TABLE OF traitement;
/

CREATE OR REPLACE TYPE animal AS OBJECT (
24
    id_animal NUMBER,
Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
25
26
27
28
    nom VARCHAR(20),
    poid FLOAT,
    TAILLE FLOAT,
    dn DATE,
29
    traitements listTraitement,
Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
30
    PRIMARY KEY (id_animal)
31
) NESTED TABLE traitements STORE AS l_traitements;
Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
32
/
33
CREATE OR REPLACE TYPE listAnimals AS TABLE OF animal;
Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
34
/
35
CREATE OR REPLACE TABLE client (
Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
36
37
38
39
40
    id_client NUMBER NOT NULL,
    nom VARCHAR(20) NOT NULL,
    prenom VARCHAR(20) NOT NULL,
    dn DATE NOT NULL,
    adresse VARCHAR(50) NOT NULL,
41
    animals listAnimals NOT NULL,
42
    numeros listNumeros NOT NULL,
Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
43
    PRIMARY KEY(id_client)
44
45
)NESTED TABLE animals STORE AS l_animals,
NESTED TABLE numeros STORE AS l_numeros;
Osvaldo Valdivia Salas's avatar
RO  
Osvaldo Valdivia Salas committed
46
47
48
49
50
51
52
53
54
55
56
57
58
/

CREATE OR REPLACE TABLE classeEspece(
    classeEscpece VARCHAR(30) NOT NULL PRIMARY KEY
);
/

CREATE OR REPLACE TABLE espece(
    classeEspece VARCHAR(30) NOT NULL,
    espece VARCHAR(20) NOT NULL,
    PRIMARY KEY(espece),
    FOREIGN KEY (classeEspece) REFERENCES classeEspece(classeEspece)
);
59
/