Forum Discussion

tbom's avatar
tbom
Contributor
14 years ago

help with stored procedures?

I have a stored procedure on a oracle db server, that I need to call from within my tc script..



the procedure header is as follows :



  PROCEDURE add_phone_call(i_from_phone IN VARCHAR2,

                           i_to_phone   IN VARCHAR2,

                           i_time       IN DATE,

                           i_duration   IN NUMBER,

                           i_amount     IN NUMBER,

                           i_taxfree    IN NUMBER,

                           i_phone_type IN VARCHAR2,

                           o_msg        OUT VARCHAR2) IS



I have tried to implement the above in c# script, using the method shown at http://tv.falafel.com/testcomplete/10-03-04/Calling_a_SQL_Stored_Procedure_from_TestComplete_Using_JScript.aspx just adding a bunch of createparam lines :








var sproc;

sproc = ADO["CreateADOCommand"]();

sproc["ConnectionString"] = "<my connection string>";

sproc["CommandType"] = adCmdStoredProc;

sproc["CommandText"] = "oss.st_general.add_phone_call";



sproc["Parameters"]["CreateParameter"]("i_from_phone", adVarChar, adParamInput, 0, fromPhone );

sproc["Parameters"]["CreateParameter"]("i_to_phone", adVarChar, adParamInput, 0, null );

sproc["Parameters"]["CreateParameter"]("i_date", adDate, adParamInput, 0, callDate);

sproc["Parameters"]["CreateParameter"]("i_duration", adVarNumeric, adParamInput, 0, null);

sproc["Parameters"]["CreateParameter"]("i_ammount", adVarNumeric, adParamInput, 0, amount);

sproc["Parameters"]["CreateParameter"]("i_taxfree", adVarNumeric, adParamInput, 0, null);

sproc["Parameters"]["CreateParameter"]("i_phone_type", adVarChar, adParamInput, 0, phoneType);

sproc["Parameters"]["CreateParameter"]("o_msg", adVarChar, adParamOutput, 0, null );



var result = sproc["Execute"]();







The above results in an error thrown at me, which indicates that parameters are wrong :

Parameter object is improperly defined. Inconsistent or incomplete information was provided



I'm stuck at this point.. Any experts that can help?



/ Thomas


The above results in an error thrown at me, which indicates that parameters are wrong :I'm stuck at this point.. Any experts that can help?/ Thomas
  • Hello Thomas,


    Why do you call the CreateParameter function with its Size parameter set to zero?

    Does the "Parameter object is improperly defined" error persist if you set Size to the actual size of the value of the parameter you create?


    Thank you.