Bonjour à tous

je dois creer une fonction qui retourne un tableau de record :
mais sqldevelloper me refuse la compilation en disant que j'utilise un type avant sa declaration :

un petit detail : la fonction devra faire partie d'un package.
Je suppose que je devrais le declarer(le type TABLEEMPLOYES) dans la specification?
mais je cree mes fonctions indivduellement puis je bidouillerai pour ensuite faire le package. Comment resoudre ce probleme?

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
CREATE OR REPLACE
FUNCTION LISTEREMPLOYES( pNomPro IN PROJETS.NOMPRO% TYPE)
RETURN TABLEEMPLOYES AS
TYPE TABLEEMPLOYES IS TABLE OF EMPLOYES% ROWTYPE INDEX BY BINARY_INTEGER;
vTableEployes TABLEEMPLOYES;
BEGIN
 
  SELECT * INTO vtableeployes
  FROM EMPLOYES
  WHERE NUMSECU IN (SELECT NUMSECU
                    FROM EMPPRO
                    WHERE NUMPRO IN (SELECT NUMPRO
                                     FROM PROJETS
                                     WHERE NOMPRO = pNomPro));
  RETURN vtableeployes;
  EXCEPTION
  WHEN NO_DATA_FOUND THEN RAISE_APPLICATION_ERROR(-20051,'Personne n est associé a ce projet');
                          RETURN NULL;
  WHEN OTHERS THEN DBMS_OUTPUT.PUTLINE('ERREUR: '||SQLCODE||SQLERRM);
                   RETURN NULL;
END LISTEREMPLOYES;