Bonjour,
J'utilise une fonction pipelined dans le package ci-dessous.
Pour exécuter ma fonction et lire les données en retour ça fonctionne bien :
select * from table(my_package.my_function)
Maintenant j'aimerai à l'intérieur de cette fonction lire la table ainsi constituée et l'utiliser dans une requête :
Si je fais ça j'ai l'erreur de compilation :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 select count(*) into i from product where id_prod not in (select id_prod from table(my_table));
ORA-00904 (20: 58): PL/SQL: ORA-00904: "MY_TABLE": invalid identifier
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 create or replace package my_package as type my_row is record ( id_prod varchar2(20) , designation varchar2(50) ); type my_table is table of my_row; function my_function return my_table pipelined; end; create or replace package body my_package as function my_function return my_table pipelined is r my_row; i number; begin r.id_prod := 'REFA'; r.designation := 'DESI A'; pipe row(r); r.id_prod := 'REFB'; r.designation := 'DESI B'; pipe row(r); select count(*) into i from product where id_prod not in (select id_prod from table(my_table)); end; end;
Comment faire un select sur la table my_table à l'intérieur de cette fonction pipelined ??
Si ça n'est pas possible je me demande si je devrais pas utiliser une table temporaire...
Cordialement.
Partager