Error in : [MySQL][ODBC 5.1 Driver][mysqld-5.5.62] OUT or INOUT argument 1 for routine db_test.NewCheckData is not a variable or NEW pseudo-variable in BEFORE trigger
Posted by: Mark Sunderland
Date: February 18, 2022 09:16AM

Hi,

I have a Stored Procedure on a MySQL DB.

Which simply takes the COUNT ROWS of a Parameter and returns the Value of that Parameter.

I would like to call this Stored Procedure to assign value to variable in my VBscript code.

This is MySql routine (stored procedure) tried and worked on MySQL db.

CREATE DEFINER=`user`@`%` PROCEDURE `NewCheckData`(OUT pOld INT (11))
BEGIN

SELECT
    COUNT(*) tOld INTO pOld
FROM
    `DoTable` 
WHERE
    DATE( myDATE ) = CURRENT_DATE;

END

VBSCRIPT CODE is as below

   On Error Resume Next
   
   Const adCmdStoredProc    = 4
   Const adInteger          = 3
   Const adCurrency         = 6
   Const adExecuteNoRecords = 128
   Const adVarChar         = 200
   Const adParamUnknown    = 0     'Direction is unknown
   Const adParamInput      = 1     'Input parameter
   Const adParamOutput     = 2     'Output parameter
   Const adParamInputOutput    = 3 'Both input and output parameter
   Const adParamReturnValue    = 4 'Return value

   Set cn = CreateObject("ADODB.Connection")
   cn.Open "DRIVER={MySQL ODBC 5.1 Driver};SERVER=XXX;PORT=3306;DATABASE=XXX;USER=XXX;PASSWORD=XXX;OPTION=3;"  
   cn.CommandTimeout = 10000
   
   Set objCmd = CreateObject("ADODB.Command")
   objCmd.ActiveConnection = cn
   objCmd.CommandType = 4
   objCmd.CommandText = "NewCheckData"
   objCmd.Parameters.Append objCmd.CreateParameter("@pOld", 3, 2)
   objCmd.Parameters("@pOld").Value = Trim(pOld)

   Set objRS = objCmd.Execute
   Set objCmd = Nothing 
   
   cn.Close()
   Set cn = Nothing

   If Err.Number <> 0 Then
     WScript.Echo "Error in : " & Err.Description
     Err.Clear
   End If
   On Error GoTo 0

Error or messagebox

Error in : [MySQL][ODBC 5.1 Driver][mysqld-5.5.62] 
OUT or INOUT argument 1 for routine db_test.NewCheckData is not a variable or NEW pseudo-variable in BEFORE trigger

Any suggestion, please.

Options: ReplyQuote


Subject
Written By
Posted
Error in : [MySQL][ODBC 5.1 Driver][mysqld-5.5.62] OUT or INOUT argument 1 for routine db_test.NewCheckData is not a variable or NEW pseudo-variable in BEFORE trigger
February 18, 2022 09:16AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.