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
| With Matable as
(
select 'J-SVLCV-SVACS' as vuegwsql, 'J-SVLCV-SVACS-S' as c2, 'SVT' as c3, 'svacs.etssvacs = svlcv.etssvlcv AND svacs.artsvacs = svlcv.artsvlcv AND svacs.actsvacs = ''S''' as whr from dual union all
select 'J-GTETS-SVCDV' , 'Etablissement - Commande' , 'SVT' , 'gtets.numgtets = svcdv.etssvcdv' from dual union all
select 'J-SVCDV-SKDRE' , 'J-SVCDV-SKDRE' , 'SVT' , 'CDV.nuisvcdv = skdre.nuiskdre' from dual union all
select 'J-SGUNI-SGART' , 'Unite vente - Article' , 'SVT' , 'Uni_Vte.numsguni += sgart.unvsgart' from dual union all
select 'J-SKLMS-SGATV' , 'J-SKLMS-SGATV' , 'SVT' , 'sklms.etosklms += sgatv.etssgatv AND sklms.artsklms += sgatv.artsgatv' from dual union all
select 'J-SKLMS-SKMVS' , 'J-SKLMS-SKMVS' , 'SVT' , 'sklms.nuisklms = skmvs.nuiskmvs' from dual union all
select 'J-SGAAE-SGART' , 'Article Etablissement - Article' , 'SVT' , 'sgart.numsgart = sgaae.artsgaae' from dual union all
select 'J-OEGES_SGAAE' , 'Article Etablissement - Gestionnaire' , 'SVT' , 'Ges_AEts.numoeges += sgaae.gessgaae' from dual union all
select 'J-SGMDV_SGAAE' , 'Article Etablissement - Mode vente' , 'SVT' , 'Mode_AEts.numsgmdv += sgaae.movsgaae AND Mode_AEts.etssgmdv += sgaae.etssgaae' from dual union all
select 'J-P_FON_SGAAE' , 'Fonction - Article Etablissement' , 'SVT' , 'FON_AEts_P.occgtpar += sgaae.fonsgaae AND FON_AEts_P.numgtets += sgaae.etssgaae AND FON_AEts_P.padgtpar += ''FONSGART''' from dual union all
select 'J-P_FNV_SGAAE' , 'Fonction Valo - Article Etablissement', 'SVT' , 'FNV_AEts_P.occgtpar += sgaae.fnvsgaae AND FNV_AEts_P.numgtets += sgaae.etssgaae AND FNV_AEts_P.padgtpar += ''FNVSGAAE''' from dual union all
select 'J-P_CAT_SGATV' , 'Categorie - Article vendu' , 'SVT' , 'CAT_AVte_P.occgtpar += sgatv.catsgatv AND CAT_AVte_P.numgtets += sgatv.etssgatv AND CAT_AVte_P.padgtpar += ''CATSGATV''' from dual union all
select 'J-SGAAE-SGATV' , 'Article Etablissement - Article Vendu', 'SVT' , 'sgaae.etssgaae = sgatv.etssgatv AND sgaae.artsgaae = sgatv.artsgatv' from dual union all
select 'J-SGATV-OETVA' , 'Article Vendu - TVA' , 'SVT' , 'TVA_AVte.numoetva += sgatv.tvvsgatv AND TVA_AVte.etsoetva += sgatv.etssgatv' from dual union all
select 'J-SGATV-OEGES' , 'Article Vendu - Gestionnaire' , 'SVT' , 'Ges_AVte.numoeges += sgatv.gessgatv' from dual union all
select 'J-SGATV-SKDRE' , 'J-SGATV-SKDRE' , 'SVT' , 'skdre.etsskdre += sgatv.etssgatv AND skdre.artskdre += sgatv.artsgatv' from dual union all
select 'J-SGATV-SKSTI' , 'J-SGATV-SKSTI' , 'SVT' , 'sksti.artsksti += sgatv.artsgatv' from dual union all
select 'J-SGATV-SGDEP' , 'Article Vendu - Depot' , 'SVT' , 'Dep_AVte.numsgdep += sgatv.depsgatv AND Dep_AVte.etssgdep += sgatv.etssgatv' from dual union all
select 'J-SGART-SVLCV' , 'J-SGART-SVLCV' , 'SVT' , 'sgart.numsgart = svlcv.artsvlcv' from dual union all
select 'J-SVCDV-SVCDV' , 'J-SVCDV-SVCDV' , 'SVT' , 'svcdv.ecvsvcdv <= 158' from dual union all
select 'J-SVCDV-SVNCV' , 'Commande - Classe' , 'SVT' , 'svcdv.clasvcdv = svncv.clasvncv AND svcdv.etssvcdv = svncv.etssvncv' from dual union all
select 'J-SVCDV-SVCLI' , 'Commande - Client' , 'SVT' , 'svcdv.clisvcdv += svcli.numsvcli AND svcdv.etssvcdv += svcli.etssvcli' from dual union all
select 'J-SVCLI-SVECD' , 'Client - Detail Echeance' , 'SVT' , 'sgecd.echsgecd = svcli.echsvcli' from dual union all
select 'J-SVCDV-SVELC' , 'J-SVCDV-SVELC' , 'SVT' , 'svelc.nuisvelc = svcdv.nuisvcdv' from dual union all
select 'J-SVCDV-SVEXP' , 'Commande - Expedition' , 'SVT' , 'svexp.numsvexp += svcdv.expsvcdv AND svexp.etssvexp += svcdv.etssvcdv' from dual union all
select 'J-SVCDV-SVFAV' , 'Commande - Facture' , 'SVT' , 'svfav.numsvfav += svcdv.favsvcdv AND svfav.etssvfav += svcdv.etssvcdv' from dual union all
select 'J-SVCDV-SVCVE' , 'Commande - Echeance' , 'SVT' , 'svcve.nuisvcve += svcdv.nuisvcdv' from dual union all
select 'J-SVCDV-SVLCV' , 'Commande - Ligne' , 'SVT' , 'svlcv.nuisvlcv = svcdv.nuisvcdv' from dual union all
select 'J-SVCDV-SVCVG' , 'Commande - Gestionnaire' , 'SVT' , 'svcvg.nuisvcvg += svcdv.nuisvcdv AND svcvg.fonsvcvg += ''VRP'' AND svcvg.rolsvcvg += ''V''' from dual union all
select 'J-SVCDV-SGDEP' , 'Commande - Depot' , 'SVT' , 'Dep_Cde.etssgdep = svcdv.etssvcdv AND Dep_Cde.numsgdep = svcdv.depsvcdv' from dual union all
select 'J-SVCDV-SGETC' , 'Commande - Etape' , 'SVT' , 'Etp_Cde.etssgetc = svcdv.etssvcdv AND Etp_Cde.etpsgetc = svcdv.ecvsvcdv AND Etp_Cde.clasgetc = svcdv.clasvcdv AND Etp_Cde.domsgetc = ''V''' from dual union all
select 'J-SVCDV-OEDEV' , 'Commande - Devise' , 'SVT' , 'svcdv.devsvcdv = Dev_Cde.numoedev' from dual union all
select 'J-SVCVG-OEGES' , 'Gestionnaire commande - Gestionnaire' , 'SVT' , 'oeges.numoeges += svcvg.gessvcvg' from dual union all
select 'J-SVEXP-SGDEP' , 'Expedition - Depot' , 'SVT' , 'Dep_Exp.etssgdep = svexp.etssvexp AND Dep_Exp.numsgdep = svexp.depsvexp' from dual
)
, sr1 as
(
select substr(vuegwsql, 3, 5) as table1,
substr(vuegwsql, -5) as table2,
vuegwsql,
whr
from matable
union
select substr(vuegwsql, -5),
substr(vuegwsql, 3, 5),
vuegwsql,
whr
from matable
)
, sr2 as
(
select level, table1, table2, whr,
ltrim(sys_connect_by_path(vuegwsql, ' -> '), ' -> ') as chemin
from sr1
where table2 = 'SVFAV'
START with table1 = 'SGART'
CONNECT BY NOCYCLE table1 = prior table2
order by level asc
)
select table1, table2, whr, chemin
from sr2
where rownum = 1;
TABLE1 TABLE2 WHR CHEMIN
------ ------ ----------------------------------------------------------------------- -----------------------------------------------
SVCDV SVFAV svfav.numsvfav += svcdv.favsvcdv AND svfav.etssvfav += svcdv.etssvcdv J-SGART-SVLCV -> J-SVCDV-SVLCV -> J-SVCDV-SVFAV |
Partager