I have been trying to invoke a stored procedure by ODBC and getting an
error - the error explanation says
- >> ":( HY000:140000F9) Dynamic SQL Error SQL error code = -104
Token unknown - line 1, char 1 call"
it looks like it is complaining about the call statement. Do you have an
example of calling one from odbc.
here is what I tried.
/**************************************************************************/
// test executing a stored procedure
/***************************************************************************/
int test_storedproc()
{
rc = 0;
printf("\n beginning table stored procedure test");
rc = pODBCBase->CreateStatement(hDBHandle, hStmtHandle, rSqlReturn);
if(rc < 0 ) // or use the rSqlReturn field itself
{
printf ("\n TEST FAILURE : OBDC statement handle Trouble in CreateStatement ",
rc) ;
return rc;
}
//
// paramaters must be bound for stored procedures
if (rc == 0)
{
printf("before SQLBindParameter 1 message");
iParmNumber = 1;
iInOutType = SQL_PARAM_INPUT;
iCDataType = SQL_C_CHAR;
iSQLDataType = SQL_VARCHAR;
iColumnSize = 0;
iDecimalDigits = 0;
InBufferPointer = 0;
InBufferLength = sizeof(Psmalltext);
LenBufferPointer = NULL;
rc = pODBCBase->BindMarkerParm(hStmtHandle, iParmNumber, iInOutType,
iCDataType, ---- this just calls SQLBindparameter
iSQLDataType, iColumnSize, iDecimalDigits,
SQLPOINTER (Psmalltext),
InBufferLength, LenBufferPointer, rSqlReturn);
if (rc < 0)
{
pODBCBase->GetDiagInfo(rSqlReturn, SQL_HANDLE_ENV, hStmtHandle);
printf ("\n FAILURE : In SQLBindParemeter 4 category (varchar) - rc -> %d ",
rc);
return rc;
}
}
memset (msg, '\0', sizeof(msg));
strcpy (msg, "testodbc");
memcpy (Psmalltext, msg, sizeof(Psmalltext));
printf("before execute Dynamic");
memset(Pmessage, '\0', sizeof(Pmessage));
strcpy ((char *)Pmessage, (char *) "call lexadmin.ins_document (?)");
****** THE CALL IN QUESTION ******
psqlchar = Pmessage;
rc =pODBCBase->ExecuteDynamic(hStmtHandle, psqlchar, rSqlReturn); -******---
this just calls SQLExecuteDirect
if(rc < 0 ) // or use the rSqlReturn field itself
{
printf ("\n TEST FAILURE : test_storedproc ", rc) ;
return rc;
}
// free the statement handle
pODBCBase->FreeStatement(hStmtHandle, rSqlReturn);
return rc;
} // end test_storedproc
********** THE DEF of the stored procedure ******
CREATE DBPROC INS_DOCUMENT(IN IDOCNAME VARCHAR(30), OUT RETURNCODE INTEGER)
--- I see I need to add anouther parm but I did not think this would be the
error
--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]