Bonjour,
j'ai une requête dans laquelle je dois faire une division, mais je n'arrive pas à la faire, chaque fois ça me dit " la commande ne se termine pas correctement" et quand j'enlève la division, ça marche.
Voici ma requête :
donc quand je fait la division ça ne marche pas , mais si je remplace par une multiplication ça marche, pourtant je suis sur que ça ne peut pas être une division par 0 car ce groupe là :
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
44 select identifiant, (NVL(( select sum(chiffre1)+sum(chiffre2) as "TOTAL GENERAL" from table1 t1 inner join table2 t5 on t5.id=t1.idrefTable1 inner join table3 t8 on t8.id=t5.idref inner join table4 t11 on t11.id=t1.idrefRefT1 inner join table5 t31 on t31.numcontrat = t1.numcontrat2 where t8.identifiant='0000379' and t5.annee='73' and t31.numcontrat=t1.numcontrat2 ),0)) as totgeneral, ( NVL(( select sum(chiffre1)+sum(chiffre2) as "TOTAL GENERAL_2" from table1 t1 inner join table2 t5 on t5.id=t1.idrefTable1 inner join table3 t8 on t8.id=t5.idref inner join table4 t11 on t11.id=t1.idrefRefT1 inner join table5 t31 on t31.numcontrat = t1.numcontrat2 where t8.identifiant='0000379' and t5.annee='73' and t31.numcontrat=t1.numcontrat2 ),0) / --probleme ici ( SELECT sum(montant) as encaissement FROM tableEncaissement_1 t12 inner join tableEncaissement_2 t3 on t3.id= t12.idreft3 where t3.idrefentreprise ='1320' and t12.code='2003' and t12.periode in ('2019M03','2019M02','2019M01') and t3.idrefentreprise = t8.id ) )as Total_global from table1 t1 inner join table2 t5 on t5.id=t1.idrefTable1 inner join table3 t8 on t8.id=t5.idref inner join table4 t11 on t11.id=t1.idrefRefT1 where t8.identifiant='123456' and t5.annee='73'
ne contient pas de 0 on est obligé d'avoir un nombre > à 0 donc je vois pas où ça peut poser problème.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 ( SELECT sum(montant) as encaissement FROM tableEncaissement_1 t12 inner join tableEncaissement_2 t3 on t3.id= t12.idreft3 where t3.idrefentreprise ='1320' and t12.code='2003' and t12.periode in ('2019M03','2019M02','2019M01') and t3.idrefentreprise = t8.id )
Merci pour votre aide.
Partager