Re: Returning parameters from an Oracle Procedure (ado & vb6).
- From: "Ralph" <nt_consulting64@xxxxxxxxx>
- Date: Thu, 30 Nov 2006 00:20:34 -0600
<dnaumowicz@xxxxxxxxx> wrote in message
news:1164833751.856412.184160@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,
I have an Oracle procedure defined as (this works in SQLPlus):
procedure fleet_prc( incriteria IN varchar2,
eng OUT varchar2,
engdt OUT varchar2,
trn OUT varchar2,
trndt OUT varchar2)
I've tried to access it via
Set cmdStoredProc = New ADODB.Command
Set cmdStoredProc.ActiveConnection = cnnOracle
cmdStoredProc.CommandType = adCmdText
strCommandText = "{call prc.fleet_prc(?,?,?,?,?)}"
cmdStoredProc.CommandText = strCommandText
cmdStoredProc.Parameters.Append
cmdStoredProc.CreateParameter("incriteria", adVarChar, adParamInput,
17, strVIN)
cmdStoredProc.Parameters.Append
cmdStoredProc.CreateParameter("eng", adVarChar, adParamOutput, 255)
cmdStoredProc.Parameters.Append
cmdStoredProc.CreateParameter("engdt", adVarChar, adParamOutput, 255)
cmdStoredProc.Parameters.Append
cmdStoredProc.CreateParameter("trn", adVarChar, adParamOutput, 255)
cmdStoredProc.Parameters.Append
cmdStoredProc.CreateParameter("trndt", adVarChar, adParamOutput, 255)
Set rsEmp = New ADODB.Recordset
Set rsEmp = cmdStoredProc.Execute()
However, at this point I receive the error:
[Microsoft][ODBC driver for Oracle]Syntax error or access
my connection string is:
Provider=MSDASQL.1;Extended
Properties="DRIVER={Microsoft ODBC for
Oracle};UID=****;PWD=***;SERVER=***;"
Any and all help would be appreciated!!!!
Thanks,
David
All you need is the procName, no '?' or braces are needed...
strCommandText = "prc.fleet_prc"
and use...
cmdStoredProc.CommandType = adCmdStoredProc
Also why mess with a recordset. Read the out values using a construct
similar to the following... [Warning Air Code!]
Private mProcParamEng As ADODB.Parameter
Set mProcParamEng = cmdStoredProc.CreateParameter( _
"eng", adVarChar, adParamOutput, 255)
cmdStoredProc.Parameters.Append mProcParamEng
mProcParamEng.Value = 0
....
cmdStoredProc.Execute
MyEng = mProcParamEng.Value
hth
-ralph
.
- References:
- Returning parameters from an Oracle Procedure (ado & vb6).
- From: dnaumowicz
- Returning parameters from an Oracle Procedure (ado & vb6).
- Prev by Date: Returning parameters from an Oracle Procedure (ado & vb6).
- Next by Date: Parameterized Queries - Variables, and Access
- Previous by thread: Returning parameters from an Oracle Procedure (ado & vb6).
- Next by thread: Parameterized Queries - Variables, and Access
- Index(es):
Relevant Pages
|
|