Salut à tous,

J’ai problème avec ma procedure pl/sql. J’obtiens la faute suivante :

PLS-00402: alias required in SELECT list of cursor to avoid duplicate column names

J’ai trois tables, toutes les 3 ont les colonnes identiques(malheureusement je ne peut rien changer).
Malgré le fait que j’utilise les alias, le problème n’est pas résolu. Quelqu’un peut il me dire ce que je dois encore faire ?

Mon code(j’ai copier quelques lignes et changer le nom des tables).

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
create or replace 
PROCEDURE P_insertion IS

    str_ereur  varchar2(200);
    sql_str     varchar2(32000);

    CURSOR C1 IS    
                      SELECT *
                      from table_1 t1, 
		      table_2 t2
                      where not exists (
                                        select * from table_3 t3
                                        where   t1.id_medecin    =   t3.id_medecin  
                                        and     t1.id_s    =   t3.id_s
                                        and     t1.id_seq    =   t3.id_seq  
                                        and     t1.id_an    =   t3.id_an
                                        and     t1.id_ste    =   t3.id_ste)
                                        and     t1.id_statut  = 'new'
                                        and     t1.id_employe   = t2.id_employe
                                       ;
BEGIN  
   FOR C1_rec IN C1 LOOP 
      begin
                insert into table_3  t3
                   ( t3.id_medecin, 
                      t3.id_section, 
                      t3.id_produit,
                      t3.id_reseau
                    )
                      VALUES 
                      (
                       C1_rec.id_medecin, 
                       C1_rec.id_section, 
                       C1_rec.id_produit,
                      C1_rec.t2.id_reseau_change
                      ) ;                        

                commit; 
         
        exception            
          when others then			
            rollback;
              str_ereur := substr(sqlerrm,1,200);
          insert into test (test ) values (str_ereur);        
        end; 
	END LOOP;
COMMIT;
END P_insertion;

Je crois que le problème est au niveau de la ligne en gras rouge.


Merci d’avance pour vos aides
Fiona