RE: Call Oracle Procedure from Excel macro

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I can't answer all of your questions for Oracle, but I have successfully done
this with PeopleSoft using ADO. I hope the following will set you on track
for looking at the appropriate arguments at least:

Set ADO "CommandText" to your stored procedure name and then set the
"CommandType" to "adCmdStoredProc"

e.g:
cnADO.CommandText = myStoredProcedureName
cnADO.CommandType = adCmdStoredProc

You don't specify if you are returning records or not; my example returns
records. So your code might look something like:

Dim adoCM As ADODB.Command
Dim adoCN As ADODB.Connection
Dim adoRS As ADODB.Recordset

Set adoCN = New ADODB.Connection
adoCN.CursorLocation = adUseClient
adoCN.Properties("Prompt") = adPromptComplete '<this is for logon not param

adoCN.Open "ODBC;YOUR_ConnectionString_for_Oracle;"

Set adoCM = New ADODB.Command
Set adoCM.ActiveConnection = adoCN
adoCM.CommandText = YourProcedureName
adoCM.CommandType = adCmdStoredProc

'Run query and populate a recordset
Set adoRS = New ADODB.Recordset
Set adoRS = adoCM.Execute

In PeopleSoft I was able to build-in the prompts into the stored procedure
on the PeopleSoft side, I don't know how to do that for Oracle or if you even
can...

HTH somehow.

"test" wrote:

> Hi ALL
> I need to call a Oracle Procedure from Excel Macro?
> Does anybody know How to do it?
> Any code samples?
> My procedure has 5 IN parameters and 1 OUT parameter.
> I was thinking of using ODBC to connect to the database.
> Please help...........urgent.........
> Thanks
>
>
>
.



Relevant Pages

  • Bind Variables ADO - Oracle
    ... I am trying to call a stored procedure in Oracle from my Visual Basic code. ... I am using MS ADO 2.7 library to do this. ...
    (microsoft.public.vb.database.ado)
  • Sending CLOBs to Oracle using VB/ADO
    ... I have to pass some XML to an Oracle 8i stored procedure, ... without too many problems simply by setting the type of the ADO ... adParamOutput) ...
    (microsoft.public.data.ado)
  • Sending CLOBs to Oracle using VB/ADO
    ... I have to pass some XML to an Oracle 8i stored procedure, ... without too many problems simply by setting the type of the ADO ... adParamOutput) ...
    (microsoft.public.vb.database.ado)
  • Missing sign in resultset field
    ... Problems with negative values from an Oracle table / Stored Procedure ... MS ADO Provider ... Only in one laboration I recieve the correct result -2. ...
    (borland.public.delphi.database.ado)
  • Re: Error in calling stored procedure via DB link
    ... "Paul Clement" wrote: ... Below is an Oracle KB article that documents the issue. ... Calling Stored Procedure over Dblink Using Oracle OleDb Provider Fails ... > symptom: Using command type adCmdStoredProc ...
    (microsoft.public.vb.database.ado)