Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Passing date value from VB to Oracle Stored Procedure
On Tue, 24 Mar 1998 11:23:21 -0500, "Melinda Schall" <no.one_at_daytonoh.ncr.com> wrote: Hi Melinda,
I know are two ways to pass date-values from VB to oracle sp's:
your VB-call might look like:
Dim oLclOraDatabase As Object
Dim szLclErrorMsg As String
Dim szLclSQL As String
Dim fLclDuringtrans As Integer
On Error GoTo OracleSPError
fLclDuringtrans = False
Set oLclOraDatabase = oGblOraSession.OpenDatabase(szGblMaklerDB, szGblUSER & "/" & szGblPWD, 0&)
oLclOraDatabase.Parameters.Add "MyDate", Date, ORAPARM_INPUT oLclOraDatabase.Parameters("MyDate").ServerType = ORATYPE_DATE
oLclOraDatabase.Parameters("MyDate").Value = DateValue(My_VB_Datevalue)
szLclSQL = "Begin my_proc(:MyDate ); End;"
oGblOraSession.DbBeginTrans
fLclDuringtrans = True
oLclOraDatabase.DbExecuteSQL (szLclSQL)
oGblOraSession.DbCommitTrans
fLclDuringtrans = False
Set oLclOraDatabase = Nothing
On Error GoTo 0
Exit Sub
OracleSPError:
'
If oLclOraDatabase.LastServerErr <> 0 Or oLclOraDatabase.LastServerErrText <> "" Then
szLclErrorMsg = oLclOraDatabase.LastServerErr & " " & oLclOraDatabase.LastServerErrText Else
szLclErrorMsg = Error
End If
MsgBox szLclErrorMsg , MB_FEHLER, Str$(Err)
If fLclDuringtrans Then
oGblOraSession.DbRollback fLclDuringtrans = False
Set oLclOraDatabase = Nothing
On Error GoTo 0
Exit Sub
End Function
>Our developers are trying to pass a date value from VB to an Oracle Stored
>Procedure and it is not working. The stored procedure's input parameter is
>defined as DATE. The VB code wants to pass the date format of MM/DD/YYYY.
>I've tried having them pass the value as a string containing the to_date
>function, i.e. to_date(vb_date, 'MM/DD/YYYY'), to the stored procedure but
>this fails as well. It seems like there must be a simple/obvious thing
>wrong...but it's eluding me and the other database developers here.
>
>Thanks in advance for any information.
-- Regards Matthias Gresz :-) GreMa_at_T-online.deReceived on Wed Mar 25 1998 - 00:00:00 CST