Procédure stockée et ADODB
Bonjour à tous,
Voici mon petit souci.
Je veux appeler une procédure stockée (sous oracle) via un script dont voici le code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| Set cn = createobject("ADODB.Connection" )
Set cmd = createobject("ADODB.Command")
strConnectionString = "Provider=OraOLEDB.Oracle;Data Source=mon_data_source;User ID=mon_user_id;Password=mon_password"
cn.Open strConnectionString
Set cmd.ActiveConnection = cn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "AGG_DB_TRANSFERT"
Set result = cmd.Execute
Set cmd = nothing
Set cn = nothing |
Voici le code de la procédure stockée.
C'est une fonction donc je ne sais pas si c'est la même syntaxe au niveau du script.
Code:
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 function AGG_DB_TRANSFERT return boolean is
valcursor ma_table1%ROWTYPE ;
Cursor mycursor is
SELECT XMD.* FROM ma_table1 XMD
JOIN ma_table2 XO ON XO.NUMOF = XMD.WO
WHERE XO.ETAT = 'E' ;
-- FOR UPDATE ;
begin
Open mycursor ;
Loop
fetch mycursor into valcursor;
exit when mycursor%NOTFOUND;
insert into ma_table3@mon_database_link
values valcursor ;
delete from ma_table1
where WO=valcursor.WO and STEP = valcursor.STEP;
--where current of mycursor;
End Loop;
commit;
close mycursor ;
RETURN TRUE;
exception
when others then
rollback;
RETURN FALSE;
end; |
Le script génère cette erreur :
Code erreur : 3001.
Source : ADODB.Command.
Description : Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another..
Au fait je pense qu'il n'aime pas du tout cette ligne :
cmd.CommandType = adCmdStoredProc
Voilà, merci d'avance.