bonjour
mon but est de gérer une base de données marchande
j ai une table commande,une table produit, avec comme relation la table compose je n' arrive pas à comprendre mes erreurs. Le trigger doit mettre à jour les valeurs globales de la commande en fonction des changement de la quantité dans compose .Merci d'avance

Voici mon code

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
create or replace trigger maj_commande
after insert or update or delete
on compose 
for each row
declare
n Number;
begin
	if inserting then
		update commande c
		set c.COM_POI=COM_POI+:new.COMP_PTPP
		and c.COM_COU=COM_COU+:new.COMP_PRTPP
		and c.COM_POR=COM_POR+:new.COMP_FDPT
		where c.COM_NUM=:new.COM_NUM;
	end if;
 
		if updating then
			update commande c1
			set c1.COM_POI=COM_POI+:new.COMP_PTPP-:old.COMP_PTPP
			and c1.COM_COU=COM_COU+:new.COMP_PRTPP-:old.COMP_PRTPP
			and c1.COM_POR=COM_POR+:new.COMP_FDPT-:old.COMP_FDPT
			where c1.COM_NUM=:new.COM_NUM;
		end if;
 
		if deleting then
			update commande c2
			set COM_POI=COM_POI-:old.COMP_PTPP
			and COM_COU=COM_COU-:old.COMP_PRTPP
			and COM_POR=COM_POR-:old.COMP_FDPT
			where c2.COM_NUM=:old.COM_NUM;
			select count(*) into n from compose co1 where co1.COM_NUM=:old.COM_NUM;
				if(n==0)
				delete from commande where COM_NUM=:old.COM_NUM; 
				end if;
		end if;
end;
/
voici les erreurs :
Line Position Text
7 3 PL/SQL: ORA-00933: la commande SQL ne se termine pas correctement
5 3 PL/SQL: SQL Statement ignored
15 4 PL/SQL: ORA-00933: la commande SQL ne se termine pas correctement
13 4 PL/SQL: SQL Statement ignored
23 4 PL/SQL: ORA-00933: la commande SQL ne se termine pas correctement
21 4 PL/SQL: SQL Statement ignored
27 10 PLS-00103: Symbole "=" rencontré à la place d'un des symboles suivants : ( - + all case mod new null any avg count current
EDIT par bouyao lire : http://www.developpez.net/forums/viewtopic.php?t=309476
et penser à