Bonjour,

j'utilise un curseur qui parcours une table, cette table contient des nom de table et une périodicité.

Voici ma procédure qui utilise le curseur :

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
 
create or replace PROCEDURE Histo_Kcarton
IS
 
v_Periodicite     number;
 
cursor C1 is
	   select Ltable,periodicite
	   from histo;
C1r	   C1%ROWTYPE;
 
 
BEGIN
 
OPEN C1;
    FETCH C1 INTO C1r;
    -- on parcours la table Histo
    while C1%FOUND loop
        -- Récupération de la periodicite
        select Periodicite into v_Periodicite
        from Histo
        where ltable = C1r.Ltable;
 
        -- on supprime les anciennes saisies
        delete from C1r.Ltable 
        where to_date(DCarton,'YYYY/MM/DD') <TO_DATE(TO_CHAR(SYSDATE,'YYYY/MM/DD'),'YYYY/MM/DD') 
        And to_date(DCarton,'YYYY/MM/DD') > TO_DATE(TO_CHAR((sysdate - C1r.periodicite),'YYYY/MM/DD'),'YYYY/MM/DD');
        commit;
 
        -- on met à jour BDE Histo
        insert into C1r.Ltable
        select * from KCarton@bdepkg0
        where to_date(DCarton,'YYYY/MM/DD') <TO_DATE(TO_CHAR(SYSDATE,'YYYY/MM/DD'),'YYYY/MM/DD') 
        And to_date(DCarton,'YYYY/MM/DD') > TO_DATE(to_char((sysdate - C1r.periodicite),'YYYY/MM/DD'),'YYYY/MM/DD');
        commit;
    FETCH C1 into C1r;
    end loop;
CLOSE C1;
END;
/
show errors;
/

et voici ce qui pose problème J'aimerais savoir si c'est correct je viens tout juste de commencer le PL/SQL.

Au passage voici les message d'erreur, rien de très impressionant table ou vue inexistante

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
 
 
SQL> @c:\oracle\script
 
Avertissement : ProcÚdure crÚÚe avec erreurs de compilation.
 
Erreurs pour PROCEDURE HISTO_KCARTON :
 
LINE/COL ERROR
-------- -----------------------------------------------------------------
23/9     PL/SQL: SQL Statement ignored
23/25    PL/SQL: ORA-00942: Table ou vue inexistante
29/9     PL/SQL: SQL Statement ignored
29/25    PL/SQL: ORA-00942: Table ou vue inexistante
 
Avertissement : ProcÚdure crÚÚe avec erreurs de compilation.
 
SQL> @c:\oracle\script
 
Avertissement : ProcÚdure crÚÚe avec erreurs de compilation.
Cordialement