Précédent   Forum des professionnels en informatique > Bases de données > Oracle
Oracle Forum Oracle : le serveur, les outils, ... Voir F.A.Q Oracle Tutoriels Oracle
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 06/03/2007, 10h46   #1
Invité de passage
 
Inscription : mars 2007
Messages : 8
Détails du profil
Informations forums :
Inscription : mars 2007
Messages : 8
Points : 2
Points : 2
Par défaut Problème de fetch d'un curseur dynamique dans une collection

je vous présente d'abord mon problème :

Code :
1
2
3
4
5
6
7
8
9
10
11
CREATE OR REPLACE PROCEDURE transaction_of_delete(l_partition IN VARCHAR2,l_commit_freq IN NUMBER) IS
TYPE c_partition_type_in IS REF CURSOR;
c_partition_in c_partition_type_in;
l_statement VARCHAR2(400);
nbr NUMBER;
BEGIN
l_statement := 'SELECT ROWNUM FROM smf_closing_prices';
OPEN c_partition_in FOR l_statement;
fetch c_partition_in INTO nbr;
close c_partition_in;
END;
Ceci fonctionne sans prob!
Mais j'aimerais le fetcher dans une collection:

Code :
1
2
3
4
5
6
7
8
9
10
11
12
CREATE OR REPLACE PROCEDURE transaction_of_delete(l_partition IN VARCHAR2,l_commit_freq IN NUMBER) IS
TYPE c_partition_type_in IS REF CURSOR;
c_partition_in c_partition_type_in;
l_statement VARCHAR2(400);
TYPE TYP_CLOSING_PRICES IS TABLE OF NUMBER;
closing_prices_list TYP_CLOSING_PRICES;
BEGIN
l_statement := 'SELECT ROWNUM FROM smf_closing_prices partition('||l_partition||')';
OPEN c_partition_in FOR l_statement;
fetch c_partition_in bulk collect INTO closing_prices_list;
close c_partition_in;
END;
Ceci me provoque une erreur à l'éxecution quand je lance la procédure!
invalid cursor! comprends pas du tout, alors que j'ai regardé plusieurs documents!

alors jai essayé sans cursor :

Code :
1
2
3
4
5
6
7
8
CREATE OR REPLACE PROCEDURE transaction_of_delete(l_partition IN VARCHAR2,l_commit_freq IN NUMBER) IS
l_statement VARCHAR2(400);
TYPE TYP_CLOSING_PRICES IS TABLE OF NUMBER;
closing_prices_list TYP_CLOSING_PRICES;
BEGIN
l_statement := 'select rownum from smf_closing_prices';
execute immediate l_statement bulk collect INTO closing_prices_list;
END;
Et ceci me provoque une erreur à la compilation au niveau de l'execute immediate!
bref je ne sais plus koi faire!
est ce qqun saurait m'éclairer merci!
sherdogvdb est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 06/03/2007, 10h53   #2
McM
Expert Confirmé Sénior
 
Inscription : juillet 2003
Messages : 3 450
Détails du profil
Informations forums :
Inscription : juillet 2003
Messages : 3 450
Points : 4 209
Points : 4 209
Quelle version ?
BULK COLLECT marche pas en 8.1.7
__________________
More Code : More Bugs. Less Code : Less Bugs
McM est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 06/03/2007, 11h00   #3
Invité de passage
 
Inscription : mars 2007
Messages : 8
Détails du profil
Informations forums :
Inscription : mars 2007
Messages : 8
Points : 2
Points : 2
Oracle8i Enterprise Edition Release 8.1.7.4.0

ce serait donc ca?

par contre quand je fais :

Code :
1
2
3
4
5
6
7
8
9
10
11
 
CREATE OR REPLACE PROCEDURE transaction_of_delete(l_partition IN VARCHAR2,l_commit_freq IN NUMBER) IS
TYPE c_partition_type_in IS REF CURSOR;
c_partition_in c_partition_type_in;
TYPE TYP_CLOSING_PRICES IS TABLE OF NUMBER;
closing_prices_list TYP_CLOSING_PRICES;
BEGIN
OPEN c_partition_in FOR SELECT ROWNUM FROM smf_closing_prices partition(P_SMF_SMFCP_20070305_D);
fetch c_partition_in bulk collect INTO closing_prices_list;
close c_partition_in;
END;
et la ca fonctionne sans prob! mais je préfererais ensuite que le cursor soit dynamique en ce qui concerne le l-partition. d'où la nécessité de le mettre entre ''. et à partir de ce moment la ca fonctionne plus!
sherdogvdb est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 14h56.


 
 
 
 
Partenaires

Hébergement Web