Hello everybody,

I am looking for the solution for my problem. I have to call from ADO in VC++ the stored procedure which has 3 input parameters and 1 output parameter. This output parameter is a table or records taken from stored procedure, so it is not the simple type parameter. I want to get anyhow this table to my C++ program but it doesn't work, although I think I did everything OK. Could you please help me with it and look what is wrong, because I cannot find any good solution in the internet.
This is a main part of my C++ function:

Code:
 
    _RecordsetPtr pRs  = NULL;
    _CommandPtr pComm  = NULL;
    _ParameterPtr pPar = NULL;

    
    strError = "DRXADODatabaseProductStaging::test\n";
    _bstr_t strMandNr, strWerkNr, strLagNr;
   // sample input parameters
    strMandNr = "001";
    strWerkNr = "63";
    strLagNr = "01";

  

    try
    {


        TESTHR(pRs.CreateInstance(__uuidof(Recordset)));
        TESTHR(pComm.CreateInstance(__uuidof(Command)));
        TESTHR(pPar.CreateInstance(__uuidof(Parameter)));


        // set the command
        _bstr_t strSQLCommand("{? = call PA_TEST.FC_GET_LAPL(?, ?, ?, { resultset 1000, p_lpl_coll })}");
        pComm->ActiveConnection = GetConnection();
        pComm->CommandText = strSQLCommand;


        // set the parameters  

        pPar = pComm->CreateParameter("RETURN_VALUE", adVarChar, adParamReturnValue, 255);
        pComm->Parameters->Append(pPar);

        pPar = pComm->CreateParameter("p_lpl_mand_nr", adVarChar, adParamInput, 3, strMandNr);
        pComm->Parameters->Append(pPar);


        pPar = pComm->CreateParameter("p_lpl_werk_nr", adVarChar, adParamInput, 3, strWerkNr);
        pComm->Parameters->Append(pPar);

        pPar = pComm->CreateParameter("p_lpl_lag_nr", adVarChar, adParamInput, 2, strLagNr);
        pComm->Parameters->Append(pPar);


        pRs->CursorType = adOpenStatic;
        pRs->CursorLocation = adUseClient;
        pRs->LockType = adLockReadOnly;
       
        // call the stored procedure
        pRs = pComm->Execute(NULL, NULL, adCmdText);
        
      // But after running the command I receive always the exception:
     // "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available"

        // check the return value
        _variant_t vtRet = pComm->Parameters->GetItem("RETURN_VALUE")->Value;

        if (vtRet.vt != VT_NULL)
        {
 
            strError += (_bstr_t) vtRet;
            
            return false;
        }

  
        return true;
        

    }
    catch (_com_error &ce)
    {
        strError += ManageException(ce);
        GetErrorLog()->Write((const char *) strError);

        return false;
    }

and this is the stored procedure definition:


Code:
create or replace package PA_TEST is

  
  -- Public type declarations
  type lapl_rectyp is record (lag_nr            lagerplaetze.lpl_lag_nr%type,
                              lpl_gang          lagerplaetze.lpl_gang%type,
                              lpl_saeule        lagerplaetze.lpl_saeule%type,
                              lpl_ebene         lagerplaetze.lpl_ebene%type);
  
  type lapl_tabtype is table of lapl_rectyp index by binary_integer;

  
  -- Public constant declarations
  
  function fc_get_lapl(p_lpl_mand_nr in varchar2
                     , p_lpl_werk_nr in varchar2
                     , p_lpl_lag_nr in varchar2
                     , p_lpl_coll out lapl_tabtype) 
  return varchar2;
  

end PA_TEST;

Thanks in advance,
Yazilim.