cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

OQL query throws Internal Error 101

Newbie

OQL query throws Internal Error 101

Here is my code.
USER_ATTR = "Bom_No, Checked_Date, Checker, Cpn, Customer_Name, Desc, Designer, Drawn_Date, Engineer, Engineered_Date, Ewo_No, Ga, Matl, Size, Title1, Title2";

sprintf(condStr, "(%s = '%s') and (% s = '%s') and (%s = '%s')", param1, param1Val, param2, param2Val, param3, param3Val);

printf("CondStr : %s", condStr);

err = PDMOQLAddStringOQLet (oql, "PDMc_PIV", condStr, "release_level", USER_ATTR, &oqlet);
if(err)
{
ReportError("OQLet can not be created.");
return ILINKONLINE_ERROR;
}

if(strcmp(relLevel, "Released- Production") ==0)
sprintf (relLevlCond, "release_level = 'Released Production");
else if(strcmp(relLevel, "Released- NonProduction") ==0)
sprintf (relLevlCond, "release_level = 'Released Non-Production"); else
sprintf (relLevlCond, "release_level = '%s", relLevel);

printf("relLevlCond : %s", relLevlCond);

// Create OQLets based on the search params.
err = PDMOQLAddStringOQLet (oql, "PDMc_ReleaseLevel", relLevlCond, ", ", &oqlet);
if(err)
{
ReportError("OQLet can not be created.");
return ILINKONLINE_ERROR;
}
/*------------------------------------------ -------------------------*\ Get the handle to the attribute on which the result of this OQL query is to be sorted. "Designer" is a versioned PI attribute. \*------------------------------------------ -------------------------*/
err = PDMPIGetAttrDefByName ("Bom_No", &attrDef);
if(err)
{
ReportError("Can't get Attribute Definition for Bom_No.");
return ILINKONLINE_ERROR;
}

/*------------------------------------------ -------------------------*\ Add this as a sort key on the OQL. \*------------------------------------------ -------------------------*/
err = PDMOQLSetSortKey (oql, attrDef);
if(err)
{
ReportError("Can't set Sort Key.");
return ILINKONLINE_ERROR;
}

/*------------------------------------------ --------------------------*\ Pass the OQL to the function PIVGetList() \*------------------------------------------ --------------------------*/
err = PDMPIVGetList( oql, &pivCursor );
if (err)
{
ReportError( "The function PDMPIVGetList returned an error.");
return ILINKONLINE_ERROR;
}

I submit the query with CondStr parameter as follows.
CondStr : (Bom_No = '000826500') and (Ewo_No = 'C22133') and (Revision = 'B'). release level as Released Production. I get internal error 101 on executing the program.

Can anybody tell me where am I going wrong on this one?

Thanks
Nikhil