bonjour,
jai une requête que je souhaiterai rendre dynamique car je dois créer une table listant les 9 niveaux d'un departement. la requete pour obtenir le niveau 1 du departement est
pour avoir le niveau 1 et 2
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 select r_dpmt.dpmtIncde,dpmt1.dpmtdsc from r_dpmt,d_dpmt dpmt1 where r_dpmt.dpmt1Incde=dpmt1.dpmtIncde
pour avoir les 3 niveaux ,j'aurais
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 select r_dpmt.dpmtIncde,dpmt1.dpmtdsc,dpmt2.dpmtdsc from r_dpmt,r_dpmt dpmt1,r_dpmt dpmt2 where r_dpmt.dpmt1Incde=dpmt1.dpmtIncde and r_dpmt.dpmt2Incde=dpmt2.dpmtIncde
cette demarche est la même quand on continue cad niveau 1à4,niveau1à5 etc
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 select r_dpmt.dpmtIncde,dpmt1.dpmtdsc,dpmt2.dpmtdsc,dpmt3.dpmtdsc from r_dpmt,r_dpmt dpmt1,r_dpmt dpmt2 where r_dpmt.dpmt1Incde=dpmt1.dpmtIncde and r_dpmt.dpmt2Incde=dpmt2.dpmtIncde and r_dpmt.dpmt3Incde=dpmt3.dpmtIncde
voici la structure de la table r_dpmtau fait je dois continuer jusqu'au 9 niveaux(c'est a dire 1 à 9).j'ai donc pensé à un job talend qui me permettra de créer la requete .J'ai penséé à un tloop mais je sais pas comment faire avancer les indices et les ajouter dans mon select et dans mon where,merci de votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 DPMTINCDE NOT NULL NUMBER(12) DPMTDSC VARCHAR2(35) CPYINCDE NOT NULL NUMBER(12) DPMT1INCDE NOT NULL NUMBER(12) DPMT2INCDE NOT NULL NUMBER(12) DPMT3INCDE NOT NULL NUMBER(12) DPMT4INCDE NOT NULL NUMBER(12) DPMT5INCDE NOT NULL NUMBER(12) DPMT6INCDE NOT NULL NUMBER(12) DPMT7INCDE NOT NULL NUMBER(12) DPMT8INCDE NOT NULL NUMBER(12) DPMT9INCDE NOT NULL NUMBER(12)
Partager