Home » Developer & Programmer » Precompilers, OCI & OCCI » access violation on OCIStmtExecute (Oracle 11g, WinXP)
access violation on OCIStmtExecute [message #336287] Fri, 25 July 2008 09:26
Messages: 6
Registered: April 2008
Junior Member

I'd like to write a blob in a external procedure. But I didn't even get a valib OCILobLocator.
I have a table objects_temp(integer obj_id, blob feature) and I inserted a row with empty_blob() before running this:

iReturn = OCIExtProcGetEnv(this->pContext, &pEnvH, &pServiceH, &pErrorH);
if (iReturn == OCI_SUCCESS || iReturn == OCI_SUCCESS_WITH_INFO) {
	/* set up return code */
	stReturn = (OCINumber *)OCIExtProcAllocCallMemory(pContext, sizeof(OCINumber));
	if (ProcessOCI_RC(pContext, pErrorH, OCINumberFromInt(pErrorH, (dvoid *)&iReturn, sizeof(iReturn), OCI_NUMBER_SIGNED, stReturn)))

	/* allocate stmt handle */
	if (ProcessOCI_RC(pContext, pErrorH, OCIHandleAlloc((dvoid *)pEnvH, (dvoid **)&pStmtH, (ub4)OCI_HTYPE_STMT, (size_t)0, (dvoid **)0)))

	/* prepare the statement SELECT feature FROM OBJECTS_TEMP WHERE obj_id = :obj_id FOR UPDATE */
	if (ProcessOCI_RC(pContext, pErrorH, OCIStmtPrepare(pStmtH, pErrorH, (text *) cSQLStmt, (ub4)strlen(cSQLStmt), (ub4) OCI_NTV_SYNTAX, (ub4) (OCI_DEFAULT))))

	/* Set up bind for obj_id */
	if (ProcessOCI_RC(pContext, pErrorH, OCIBindByPos(pStmtH, &pBindH, pErrorH, (ub4)1, (dvoid *)this->iObj_ID, (sb4)(sizeof(this->iObj_ID)), (ub2)SQLT_INT, (dvoid *)0, (ub2 *)0, (ub2 *)0, (ub4)0, (ub4 *)0, (ub4)OCI_DEFAULT)))

	/* allocate blob locator */
	if (ProcessOCI_RC(pContext, pErrorH, OCIDescriptorAlloc((dvoid *) pEnvH, (dvoid **) &pBlob, (ub4) OCI_DTYPE_LOB, (size_t) 0, (dvoid **) 0)))

	/* Set up define for blob locator */
	if (ProcessOCI_RC(pContext, pErrorH, OCIDefineByPos(pStmtH, &pDefineH, pErrorH, (ub4)1, (dvoid *)&pBlob, 0, (ub2)SQLT_BLOB, (dvoid *)0, (ub2 *)0, (ub2 *)0, (ub4)OCI_DEFAULT)))

	/* execute statement */
	if (ProcessOCI_RC(pContext, pErrorH, OCIStmtExecute(pServiceH, pStmtH, pErrorH, (ub4)0, (ub4)0, 0, 0, (ub4)OCI_DEFAULT)))


Every return value is valid but when it comes to the execution of OCIStmtExecute I get following error message in VS2005 debugging the external procedure with extproc:

Eine Ausnahme (erste Chance) bei 0x6101e0f8 in extproc.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x0000001e.
Eine Ausnahme (erste Chance) bei 0x00407aa7 in extproc.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x00000000.

first chance exception at 0x6101e0f8/0x00407aa7 in extproc.exe: 0xC0000005: access violation while reading at position 0x0000001e/0x00000000.

What am I doing wrong??
Can anyone help me please?

Previous Topic: tool to design Flowchart for the given code automatically
Next Topic: With statement over oci
Goto Forum:

Current Time: Thu Feb 29 18:43:46 CST 2024