Bonjour à tous,
Après avoir épluché les 19 pages de post sans résultat , je me résous a quémander de l'aide !
Alors voila mon problème : je veux créer une procédure stoquée dans Interbase qui insère des lignes dans une table (jusqu'ici tout va bien), mais la boucle d'insertion utilise les valeurs d'une deuxième procedure qui va lire dans la meme table. Ce qui fait que les lignes qui sont en train d'être insérées par la procedure 1 ne sont pas prises en comptes par la 2 (euh, je suis clair la ?). Donc en gros mon problème c'est de pouvoir faire un commit à l'interieur d'une procedure stoquée.
je mets les codes des procedures a tout hasard !
Proc1 :
et la 2eme proc :
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
38
39
40
41
42
43 create procedure PROC1 (VALPOINT decimal(15,2)) returns (NB_MAJ integer) as declare variable CLI integer; declare variable CDE integer; declare variable PAYE decimal(15,2); declare variable COMPT integer; declare variable TOT integer; begin NB_MAJ = 0; for select LECLI, LACOM, HT_PAYE from DONNE_LISTE_FACT_POINTS into :CLI, :CDE, :PAYE do begin if (PAYE is not null) then begin select count(ID) from POINTS_MVMT where (IDCLI = :CLI) and (IDCDE = :CDE) into :COMPT; if (:COMPT = 0) then begin TOT = 0; select LESOLDE from PROC2(:CLI) into :TOT; insert into POINTS_MVMT (IDCLI, IDCDE, DATE_MVT, LIBELLE, HT, POINTS, SOLDE) select :CLI, :CDE, COMMANDE.DATEPAY, COMMANDE.CHRONOFACT, :PAYE, :VALPOINT*:PAYE, :TOT from COMMANDE where COMMANDE.ID = :CDE; NB_MAJ = :NB_MAJ+1; end suspend; end end end^
Voila, merci d'avance pour toute aide !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 create procedure DONNE_SOLDE_POINTS (CLI integer) returns (LESOLDE integer) as begin select SOLDE from POINTS_MVMT where ID = (select MAX(ID) from POINTS_MVMT where IDCLI=:CLI) into :LESOLDE; end^
Jerome.
Partager