Call oracle stored procedure that have a NUMBER argument



Hello!

Im using ADO from C++ to call an Oracle stored procedure that has an
NUMBER parameter. Here is the procedure:

PROCEDURE get_packages(searchType IN NUMBER, crs OUT ref_crs ) IS
BEGIN
....
END packages.

The value that i want to sent to searchType is a long and i do like
this:

//first try
CComVariant par = CComVariant(value);
//second try
VARIANT par;
VariantInit(&par);
par.lVal = value;
par.vt = VT_I4;

CComBSTR name = "get_packages";
enum DataTypeEnum type = adNumeric;
CComVariant value = 100;
enum ParameterDirectionEnum where = adParamInput;
long size = sizeof(long);
int precision = 10;
CComPtr<_Parameter> param;
HRESULT hr = m_Command->CreateParameter(name ,type, where, size ,
value, &param);
if (precision!=0)
param->put_Precision(precision);

CComPtr<Parameters> params;
if (SUCCEEDED(hr)) hr = m_Command->get_Parameters(&params);
if (SUCCEEDED(hr)) hr = params->Append(param);

CComVariant Empty(vtMissing);
CComVariant Empty2(DISP_E_PARAMNOTFOUND);
CComPtr<_Recordset> prec;
hr = m_Command->Execute(&Empty, &Empty2, adCmdStoredProc, &prec);

I get no error, but in the stored procedure i get the value for
searchType = -2147352572;

Dose anyone knows what i'm doing wrong?
Is this the way how i should send a LONG value to NUMBER in Oracle?
Is adNumber the type i should use for parameter, or adInteger (without
seting the Precision) (i tried and i get the same).

I was looking over forums and example something like this, but i had
no luck... Maybe some one here can help me out.

Thanks a lot!
.



Relevant Pages