oracle ora06502,ORA-24811 and ORA-06502

On Windows, using Visual C++ I wrote a COM object that has 3 methods. Each calls a Oracle stored procedure. It was previously working but after rebuilding and with using the latest Oracle Provider for OLE DB it stopped working.

For example, one method calls the following stored procedure ;

CREATE OR REPLACE PACKAGE BODY PK_TEST AS

PROCEDURE SP_GET_CLOB (ID IN VARCHAR2,

DATA OUT CLOB)

IS

BEGIN

SELECT CT.CLOB_DATA.GETCLOBVAL() INTO DATA

FROM CLOB_TABLE CT

WHERE CLOB_ID = ID;

EXCEPTION

WHEN OTHERS THEN

RAISE;

END SP_GET_CLOB;

The code edited down to try to keep it short is:

#define SHOPPER_ID_SIZE 64

#define SHOPPING_BASKET_SIZE 98304

typedef struct tagSP_GET_BASKET

{

wchar_t shopper_id[SHOPPER_ID_SIZE];

wchar_t shopping_basket[SHOPPING_BASKET_SIZE];

}SP_GET_BASKET_PROCPARAMS;

STDMETHODIMP CShoppingCart::getbasket(BSTR shopperid, VARIANT shoppingbasket, VARIANTresult)

{

//...

//Set the ORAPROP_SPPrmsLOB property to true to indicate the provider

// that a LOB parameter is being passed to stored procedure

//...omitted to shorten

//...

for (int i = 0; i < nParams; i++)

{

dbbinding.obLength = 0;

dbbinding[i].obStatus = 0;

dbbinding[i].pTypeInfo = NULL;

dbbinding[i].pObject = NULL;

dbbinding[i].pBindExt = NULL;

dbbinding[i].dwPart = DBPART_VALUE;

dbbinding[i].dwMemOwner = DBMEMOWNER_CLIENTOWNED;

dbbinding[i].dwFlags = 0;

dbbinding[i].bScale = 0;

}

//binding for shopperid parameter - a string "1"

dbbinding[0].iOrdinal = 1;

dbbinding[0].obValue = offsetof(SP_GET_BASKET_PROCPARAMS,shopper_id);

dbbinding[0].eParamIO = DBPARAMIO_INPUT;

dbbinding[0].cbMaxLen = SHOPPER_ID_SIZE * sizeof( wchar_t);

dbbinding[0].wType = DBTYPE_WSTR;

dbbinding[0].bPrecision = 0;

//Parameter binding for CLOB

dbbinding[1].iOrdinal = 2;

dbbinding[1].obValue = offsetof(SP_GET_BASKET_PROCPARAMS, shopping_basket);

dbbinding[1].eParamIO = DBPARAMIO_OUTPUT;

dbbinding[1].cbMaxLen = SHOPPING_BASKET_SIZE * sizeof( wchar_t);

dbbinding[1].wType = DBTYPE_WSTR;

SP_GET_BASKET_PROCPARAMS sprocparams;

wcscpy(sprocparams.shopper_id,shopperid);

DBPARAMS myparams;

myparams.pData = (void *)&sprocparams;

myparams.cParamSets = 1;

myparams.hAccessor = hAccessor;

long cNumRows;

//Execute the command.

IRowset *pIRowset;

if(FAILED(hr = pICommandText->Execute(NULL, IID_NULL,myparams, &cNumRows,(IUnknown **)&pIRowset)))

{

// ORA-06502:numeric or value error: character string buffer too small

// ORA-24811: less data provided for writing than indicated

}

//...

}

I think it must have something to do with the binding information I use for the OUT CLOB parameter. Does anyone have experience with setting up the binding for a CLOB OUT parameter??

Does anyone know exactly how I can make some headway in figuring out the ORA-6502 or ORA-24811 errors??

Am I setting up the cbMaxLen correctly?????

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值