Bonjour, me voici avec un nouveau problème, en effet dans une requête dans le select j'ai:

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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
SUM(CASE
    WHEN indicateur = 'Total traitées' and unite = 'Nombre' then s1_nbr_appr
    WHEN indicateur = 'Total traitées' and unite = 'Montant' then s1_mnt_tt_appr
    WHEN indicateur = 'Total traitées' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Total réglées' and unite = 'Nombre' then s1_nbr_paid
    WHEN indicateur = 'Total réglées' and unite = 'Montant' then s1_mnt_tt_paid
    WHEN indicateur = 'Total réglées' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont retard' and unite = 'Nombre' then s1_nb_p_late
    WHEN indicateur = 'Dont retard' and unite = 'Montant' then s1_mnt_p_late
    WHEN indicateur = 'Dont retard' and unite = 'Pourcentage' then CASE WHEN s1_mnt_tt_paid <> 0 THEN s1_nb_p_late/s1_mnt_tt_paid ELSE 0 END
    WHEN indicateur = 'Acquisition' and unite = 'Nombre' then s1_nbr_acq
    WHEN indicateur = 'Acquisition' and unite = 'Montant' then s1_mnt_tt_acq
    WHEN indicateur = 'Acquisition' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont manuelles' and unite = 'Nombre' then CASE WHEN orig.s1_cde_orig = 'ONL' THEN S1_NBR_ACQ ELSE 0 END
    WHEN indicateur = 'Dont manuelles' and unite = 'Montant' then CASE WHEN orig.s1_cde_orig = 'ONL' THEN S1_MNT_TT_ACQ ELSE 0 END
    WHEN indicateur = 'Dont manuelles' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont EDI' and unite = 'Nombre' then CASE WHEN orig.s1_cde_orig = 'EDI' THEN S1_NBR_ACQ ELSE 0 END
    WHEN indicateur = 'Dont EDI' and unite = 'Montant' then CASE WHEN orig.s1_cde_orig = 'EDI' THEN S1_MNT_TT_ACQ ELSE 0 END
    WHEN indicateur = 'Dont EDI' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont Numérisation' and unite = 'Nombre' then CASE WHEN orig.s1_cde_orig = 'NUM' THEN S1_NBR_ACQ ELSE 0 END
    WHEN indicateur = 'Dont Numérisation' and unite = 'Montant' then CASE WHEN orig.s1_cde_orig = 'NUM' THEN S1_MNT_TT_ACQ ELSE 0 END
    WHEN indicateur = 'Dont Numérisation' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Pièces imputées' and unite = 'Nombre' then s1_nbr_acct
    WHEN indicateur = 'Pièces imputées' and unite = 'Montant' then s1_mnt_tt_acct
    WHEN indicateur = 'Pièces imputées' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont directement imputables' and unite = 'Nombre' then s1_nbr_dir_imp
    WHEN indicateur = 'Dont directement imputables' and unite = 'Montant' then 0
    WHEN indicateur = 'Dont directement imputables' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Pièces rapprochées' and unite = 'Nombre' then s1_nbr_mtch
    WHEN indicateur = 'Pièces rapprochées' and unite = 'Montant' then s1_mnt_tt_mtch
    WHEN indicateur = 'Pièces rapprochées' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont directement rapprochées' and unite = 'Nombre' then s1_nbr_dir_rap
    WHEN indicateur = 'Dont directement rapprochées' and unite = 'Montant' then 0
    WHEN indicateur = 'Dont directement rapprochées' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Pièces approuvées' and unite = 'Nombre' then s1_nbr_appr
    WHEN indicateur = 'Pièces approuvées' and unite = 'Montant' then s1_mnt_tt_appr
    WHEN indicateur = 'Pièces approuvées' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont directement BAP' and unite = 'Nombre' then s1_nb_auto
    WHEN indicateur = 'Dont directement BAP' and unite = 'Montant' then 0
    WHEN indicateur = 'Dont directement BAP' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Commandes' and unite = 'Nombre' then CASE WHEN S1_PO_FLG = '1' THEN s1_nbr_appr ELSE 0 END
    WHEN indicateur = 'Commandes' and unite = 'Montant' then CASE WHEN S1_PO_FLG = '1' THEN s1_mnt_tt_appr ELSE 0 END
    WHEN indicateur = 'Commandes' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont en régularisation' and unite = 'Nombre' then s1_nb_regul
    WHEN indicateur = 'Dont en régularisation' and unite = 'Montant' then 0
    WHEN indicateur = 'Dont en régularisation' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Réceptions' and unite = 'Nombre' then s1_nbr_acq
    WHEN indicateur = 'Réceptions' and unite = 'Montant' then s1_mnt_tt_acq
    WHEN indicateur = 'Réceptions' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont saisies en retard' and unite = 'Nombre' then s1_nb_rcpt_sup
    WHEN indicateur = 'Dont saisies en retard' and unite = 'Montant' then 0
    WHEN indicateur = 'Dont saisies en retard' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Rapprochement' and unite = 'Nombre' then s1_nbr_mtch
    WHEN indicateur = 'Rapprochement' and unite = 'Montant' then s1_mnt_tt_mtch
    WHEN indicateur = 'Rapprochement' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont exception de rapprochement' and unite = 'Nombre' then s1_nbr_mtch-s1_nb_ss_except
    WHEN indicateur = 'Dont exception de rapprochement' and unite = 'Montant' then 0
    WHEN indicateur = 'Dont exception de rapprochement' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont existence R500' and unite = 'Nombre' then CASE WHEN S1_R500_FLG = '1' THEN S1_NBR_MTCH ELSE 0 END
    WHEN indicateur = 'Dont existence R500' and unite = 'Montant' then CASE WHEN S1_R500_FLG = '1' THEN S1_MNT_TT_MTCH ELSE 0 END
    WHEN indicateur = 'Dont existence R500' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Approbation' and unite = 'Nombre' then s1_nbr_appr
    WHEN indicateur = 'Approbation' and unite = 'Montant' then s1_mnt_tt_appr
    WHEN indicateur = 'Approbation' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont approbation après échéance' and unite = 'Nombre' then 0
    WHEN indicateur = 'Dont approbation après échéance' and unite = 'Montant' then 0
    WHEN indicateur = 'Dont approbation après échéance' and unite = 'Pourcentage' then 0
    WHEN indicateur = 'dont pièces < 300 euros' and unite = 'Nombre' then CASE WHEN mnt.s1_borne_inf < 300 THEN s1_nbr_appr ELSE 0 END
    WHEN indicateur = 'dont pièces < 300 euros' and unite = 'Montant' then CASE WHEN mnt.s1_borne_inf < 300 THEN s1_mnt_tt_appr ELSE 0 END
    WHEN indicateur = 'dont pièces < 300 euros' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Pièces acheminées' and unite = 'Nombre' then s1_nbr_created
    WHEN indicateur = 'Pièces acheminées' and unite = 'Montant' then 0
    WHEN indicateur = 'Pièces acheminées' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Approbation' and unite = 'Nombre' then s1_nbr_appr
    WHEN indicateur = 'Approbation' and unite = 'Montant' then s1_mnt_tt_appr
    WHEN indicateur = 'Approbation' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont délai < 15 jours' and unite = 'Nombre' then s1_nb_ach_15
    WHEN indicateur = 'Dont délai < 15 jours' and unite = 'Montant' then 0
    WHEN indicateur = 'Dont délai < 15 jours' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont délai entre 15 et 30 jours' and unite = 'Nombre' then s1_nb_ach_30
    WHEN indicateur = 'Dont délai entre 15 et 30 jours' and unite = 'Montant' then 0
    WHEN indicateur = 'Dont délai entre 15 et 30 jours' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont délai entre 30 et 45 jours' and unite = 'Nombre' then s1_nb_ach_45
    WHEN indicateur = 'Dont délai entre 30 et 45 jours' and unite = 'Montant' then 0
    WHEN indicateur = 'Dont délai entre 30 et 45 jours' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont délai entre 45 et 60 jours' and unite = 'Nombre' then s1_nb_ach_60
    WHEN indicateur = 'Dont délai entre 45 et 60 jours' and unite = 'Montant' then 0
    WHEN indicateur = 'Dont délai entre 45 et 60 jours' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont délai > 60 jours' and unite = 'Nombre' then s1_nb_ach_60
    WHEN indicateur = 'Dont délai > 60 jours' and unite = 'Montant' then 0
    WHEN indicateur = 'Dont délai > 60 jours' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Pièces payées' and unite = 'Nombre' then s1_nbr_paid
    WHEN indicateur = 'Pièces payées' and unite = 'Montant' then s1_mnt_tt_paid
    WHEN indicateur = 'Pièces payées' and unite = 'Pourcentage' then 1
    WHEN indicateur = 'Dont pénalités de retard' and unite = 'Nombre' then 0
    WHEN indicateur = 'Dont pénalités de retard' and unite = 'Montant' then s1_penal_amt
    WHEN indicateur = 'Dont pénalités de retard' and unite = 'Pourcentage' then 1
    ELSE 0 
  END) as valeur
Mais c'est ultra long, ça alourdi énormément la requête, et j'aimerai savoir si il y a une autre solution (autre que des decode et des case when) afin d'optimiser un peu tout ça.

Peu être avec du pl/sql ou des fonction oracle j'en sais rien par contre je n'ai pas le droit de créer de type, de tables ... (juste des droits en consultation)

Merci d'avance.