简体   繁体   中英

passing parameter from vbscript to oracle stored procedure

Dim strConnection, conn, rs, strSQL, objCommand, param strConnection = "Driver={Oracle ODBC Driver};Data Source=DSNNAME;User Id=Username;Password=password;" Set conn = CreateObject("ADODB.Connection") conn.Open strConnection

Dim cmdInsert As ADODB.Command
Set cmdInsert = New ADODB.Command
cmdInsert.ActiveConnection = conn
cmdInsert.CommandText = "sp_ins_test"
cmdInsert.CommandType = 4
cmdInsert.Parameters.Refresh

Set param = cmdInsert.Parameters
param.Append cmdInsert.CreateParameter("v_BG_EI_DEFECT_TYPE", 200, 1, 100, "abc")
param.Append cmdInsert.CreateParameter("v_BG_EI_APP_ID", 3, 1, 8, 1) 
param.Append cmdInsert.CreateParameter("v_BG_DETECTION_DATE", 133, 1, 100, 8/6/2010)

cmdInsert.Execute

It is throwing error as Character to number conversion error but i am passing int the code is 3 for integer(but the datatype is number in database) and also passing date

Please tell me how to pass parameters to date and number datatype in oracle..

I can see at least these problems:

  • If the script really shall be VBScript, then As ADODB.Command and New ADODB.Command are illegal; these are valid in VB only. Use CreateObject instead.
  • 8/6/2010 is not a valid date literal, it is an integer expression evaluating to a very small value (almost 0); use #8/6/2010# instead.

I hope this helps.

您正在将空strings传递到参数中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM