1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| With MaVue AS
(
select 'C20294' as id_cana, 20364 as id_noeud, 0.234 as zfe_amont, 0.21 as zfe_aval, 'AVAL' as cote_noeud from dual union all
select 'C20307' , 20365 , 0.223 , 0.199 , 'AMONT' from dual union all
select 'C20345' , 20365 , 0.124 , 0.1 , 'AMONT' from dual union all
select 'C20366' , 20365 , 0.435 , 0.411 , 'AVAL' from dual union all
select 'C20367' , 20364 , 0.487 , 0.463 , 'AMONT' from dual
)
select id_noeud,
rtrim(replace(replace(XMLAGG(XMLElement("x", id_cana || '_' ||
to_char(case cote_noeud
when 'AVAL' then zfe_aval
when 'AMONT' then zfe_amont
end, 'fm0D999', 'nls_numeric_characters=''.,''') || '_' || cote_noeud) order by id_cana asc),
'<x>', ''), '</x>', '\n'), '\n') as res
from MaVue
group by id_noeud
order by id_noeud asc;
ID_NOEUD RES
20364 C20294_0.21_AVAL\nC20367_0.487_AMONT
20365 C20307_0.223_AMONT\nC20345_0.124_AMONT\nC20366_0.411_AVAL |
Partager