Commit c5990dfe authored by Gaetan Carabetta's avatar Gaetan Carabetta

Update SQL_OO.sql

parent 878b1c3a
......@@ -80,32 +80,44 @@ CREATE OR REPLACE TYPE ListeRefEspece AS TABLE OF RefEspece;
CREATE OR REPLACE TYPE Medicament AS OBJECT(
nomMolec VARCHAR(20),
descriptions VARCHAR(100),
especes ListeRefEspece
--MEMBER FUNCTION espece_autoriser(espece IN|OUT VARCHAR(20)) RETURN BOOLEAN
medEspeces ListeRefEspece,
MEMBER FUNCTION espece_autoriser(species IN VARCHAR) RETURN BOOLEAN
);
/
/*
CREATE TYPE BODY Medicament
IS
MEMBER FUNCTION espece_autoriser(espece IN|OUT VARCHAR(20)) RETURN BOOLEAN
IS
BEGIN
r := SELECT COUT(*) FROM Medicament m
RETURN duree(SELF.debut,SELF.fin);
END;
END;
/
*/
CREATE TABLE tMedicament OF Medicament(
PRIMARY KEY (nomMolec),
descriptions NOT NULL
) NESTED TABLE especes STORE AS ntRefEspeces;
) NESTED TABLE medEspeces STORE AS ntRefEspeces;
/
/*
CREATE OR REPLACE TYPE BODY Medicament
IS
MEMBER FUNCTION espece_autoriser(species VARCHAR) RETURN BOOLEAN
IS
resultat BOOLEAN;
espe Espece;
found VARCHAR(20);
BEGIN
SELECT REF(te) INTO espe
FROM tEspece te
WHERE te.espece = species;
SELECT med.nommolec INTO found
FROM tMedicament med
WHERE med.medespeces = espe;
IF found THEN
resultat := True;
ELSE
resultat := False;
END IF;
RETURN resultat;
END;
END;
/
*/
CREATE OR REPLACE TYPE Posologie AS OBJECT(
nomMolec REF Medicament,
......@@ -180,21 +192,4 @@ CREATE TABLE Client (
l_animal ListeRefAnimal
) NESTED TABLE l_animal STORE AS ntAnimaux;
/
CREATE TYPE BODY esp IS
MEMBER FUNCTION espece_autoriser(espece IN STRING) RETURN BOOL
IS
res BOOL;
esp e is
SELECT especes.espece
FROM Medicament
WHERE especes.espece = espece;
IF esp THEN
res := True;
ELSE
res := False;
END IF;
RETURN res;
END;
END;
/
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment