Forum,
J'espère que vous allez bien malgré la chaleur. Moi, par contre, je chauffe mais je ne trouve pas.
J'ai le xml suivant - c'est pour un dossier (les identifiants sont fictifs) :
Code XML : 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 <FiscalHouseHoldResult> <FiscalHouseHold> <Beneficiary foreignFunctionary="false">77100519963</Beneficiary> <FiscalPartners> <FiscalPartner foreignFunctionary="false">75021319687</FiscalPartner> </FiscalPartners> </FiscalHouseHold> <ThresHoldPeriods> <ThresHoldPeriod> <Thresholds> <Threshold> <ThresholdAmount>31000.0</ThresholdAmount> <BelowThresHold>false</BelowThresHold> </Threshold> <Threshold> <ThresholdAmount>45000.0</ThresholdAmount> <BelowThresHold>false</BelowThresHold> </Threshold> </Thresholds> <ValidityPeriod> <StartDate>2020-01-01</StartDate> <EndDate>2020-02-29</EndDate> </ValidityPeriod> </ThresHoldPeriod> <ThresHoldPeriod> <Thresholds> <Threshold> <ThresholdAmount>31620.0</ThresholdAmount> <BelowThresHold>false</BelowThresHold> </Threshold> <Threshold> <ThresholdAmount>45900.0</ThresholdAmount> <BelowThresHold>false</BelowThresHold> </Threshold> </Thresholds> <ValidityPeriod> <StartDate>2020-03-01</StartDate> <EndDate>2020-12-31</EndDate> </ValidityPeriod> </ThresHoldPeriod> </ThresHoldPeriods> </FiscalHouseHoldResult> <FiscalHouseHoldResult> <FiscalHouseHold> <Beneficiary foreignFunctionary="false">77100519963</Beneficiary> <FiscalPartners> <FiscalPartner foreignFunctionary="false">75021319687</FiscalPartner> <FiscalPartner foreignFunctionary="false">77061189654</FiscalPartner> </FiscalPartners> </FiscalHouseHold> <ThresHoldPeriods> <ThresHoldPeriod> <Thresholds> <Threshold> <ThresholdAmount>31000.0</ThresholdAmount> <BelowThresHold>false</BelowThresHold> </Threshold> <Threshold> <ThresholdAmount>45000.0</ThresholdAmount> <BelowThresHold>false</BelowThresHold> </Threshold> </Thresholds> <ValidityPeriod> <StartDate>2020-01-01</StartDate> <EndDate>2020-02-29</EndDate> </ValidityPeriod> </ThresHoldPeriod> <ThresHoldPeriod> <Thresholds> <Threshold> <ThresholdAmount>31620.0</ThresholdAmount> <BelowThresHold>false</BelowThresHold> </Threshold> <Threshold> <ThresholdAmount>45900.0</ThresholdAmount> <BelowThresHold>false</BelowThresHold> </Threshold> </Thresholds> <ValidityPeriod> <StartDate>2020-03-01</StartDate> <EndDate>2020-12-31</EndDate> </ValidityPeriod> </ThresHoldPeriod> </ThresHoldPeriods> </FiscalHouseHoldResult>
Ce que je voudrais obtenir, c'est le résultat dans le premier tableau (en deux lignes) à la place du résultat du second tableau (en quatre lignes) :
Ma requête est celle-ci :
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 WITH xml_dat AS ( SELECT imff.FILE_NUMBER AS FileN ,EXTRACT(XMLTYPE(IMFF.CONTENT ), '//Body/Response/FiscalHouseHoldResults/FiscalHouseHoldResult' ) AS XML_Revenus ,EXTRACT(XMLTYPE(IMFF.CONTENT ), '//Body/Response/FiscalHouseHoldResults/FiscalHouseHoldResult/FiscalHouseHold' ) AS XML_Couple ,EXTRACT(XMLTYPE(IMFF.CONTENT ), '//Body/Response/FiscalHouseHoldResults/FiscalHouseHoldResult/FiscalHouseHold' ) AS beneuro FROM inbox_messages_for_file imff WHERE imff."TYPE" = 'T014' AND to_char(imff.reception_date , 'yyyy') = 2022 AND imff.file_number IN (3001233) ) SELECT * FROM xml_dat , XMLTABLE('/FiscalHouseHold' PASSING xml_dat.XML_Couple COLUMNS Benef VARCHAR2(255) PATH './Beneficiary' ) x , XMLTABLE ( ' for $x in /FiscalHouseHoldResult for $y in $x/FiscalHouseHold let $z := string-join( for $zz in $y/FiscalPartners/FiscalPartner return $zz , " - ") return $z ' PASSING xml_dat.XML_Revenus COLUMNS Niss_Part VARCHAR2(40) PATH '.' ) z ;
Si vous pouvez m'aider alors je suis preneur car je retourne ce truc dans tout les sens sans arriver à quelque chose de concluant.
NB : après avoir résolu ce problème, la prochaine étape sera d'ajouter les revenus et les périodes pour obtenir un des deux tableaux suivants (le second, c'est mieux évidemment) :
Merci d'avance pour toutes vos idées...
Partager