Extension THE
Définition : THE
Syntaxe :
Appuyer sur espace pour rester en pause.
INSERT INTO THE (SELECT ...) VALUES (...)
DELETE THE (SELECT ...) WHERE ...
UPDATE THE (SELECT ...) SET ... WHERE ...
Exemple : INSERT d'un scalaire ou d'un enregistrement dans une collection
Appuyer sur espace pour rester en pause.
CTRL+C pour copier, CTRL+V pour coller
1
INSERT INTO tIntervenant (pknom, prenom, bureau, ltelephones, lspecialites)
2
VALUES (
3
'Dumas',
4
'Leonard',
5
typBureau('R','C',123),
6
typListeTelephones(0344234423),
7
typListeSpecialites()
8
);
9
10
INSERT INTO THE (SELECT i.ltelephones FROM tIntervenant i WHERE i.pknom='Dumas')
11
VALUES (0666666666);
12
13
INSERT INTO THE (SELECT i.lspecialites FROM tIntervenant i WHERE i.pknom='Dumas')
14
VALUES (typSpecialite('BD','SGBDR'));
INSERT INTO tIntervenant (pknom, prenom, bureau, ltelephones, lspecialites) VALUES ( 'Dumas', 'Leonard', typBureau('R','C',123), typListeTelephones(0344234423), typListeSpecialites() ); INSERT INTO THE (SELECT i.ltelephones FROM tIntervenant i WHERE i.pknom='Dumas') VALUES (0666666666); INSERT INTO THE (SELECT i.lspecialites FROM tIntervenant i WHERE i.pknom='Dumas') VALUES (typSpecialite('BD','SGBDR'));
Remarque :
L'emploi de typListeSpecialites()
permet de déclarer une collection imbriquée vide dans tIntervenant
. La collection ne contient aucun élément initialement, ils peuvent être ajoutés ultérieurement grâce à l'instruction INSERT INTO THE
.
Exemple : DELETE d'un objet dans une collection
Appuyer sur espace pour rester en pause.
Exemple : UPDATE d'un objet dans une collection
Appuyer sur espace pour rester en pause.
CTRL+C pour copier, CTRL+V pour coller
1
UPDATE THE (SELECT i.lspecialites FROM tIntervenant i WHERE i.pknom='Dumas') nt
2
SET nt.technologie='SGBDRO'
3
WHERE nt.domaine='BD';
UPDATE THE (SELECT i.lspecialites FROM tIntervenant i WHERE i.pknom='Dumas') nt SET nt.technologie='SGBDRO' WHERE nt.domaine='BD';