9

I am getting some weird behavior of Pro-C procedure as shown below:

#define BGHCPY_TO_ORA(dest, source) \
{ \
(void)strcpy((void*)(dest).arr, (void*)(source)); \
(dest).len = strlen((const char *)(dest).arr); \
}
#define BGHCPY_FROM_ORA(dest, source) \
{ \
(void)memcpy((void*)(dest), (void*)(source).arr, (size_t)(source).len); \
(dest)[(source).len] = '\0'; \
} 

long fnSQLMarkProcessed (char *pszRowId, char *pszMarker)
{
  BGHCPY_TO_ORA (O_rowid_stack,    pszRowId);
  BGHCPY_TO_ORA (O_cust_processed, pszMarker);

  EXEC SQL
       UPDATE  document_all
          SET  processed_by_bgh = :O_cust_processed
        WHERE  rowid = :O_rowid_stack;

  return (sqlca.sqlcode);
}

The input arguments values passed to above function is

pszRowId = [AAAF1lAAIAABOoRAAB], pszMarker=X

The query return the error code:02115 with following message:

SQL Error:02115 Code interpretation problem -- check COMMON_NAME usage

I am using Oracle as the backend database.

Can anyone provide me information on what are the possible causes for this failed query?

Any help is highly appreciated.

Flags used during PRO-C Compilation is defined below:

------/u01/app/oracle/product/8.1.6/ORACLE_HOME/bin/proc `echo  -Dbscs5 -Dsun5 -I/export/home/bscsobw/bscs6/src/CoreDumpIssue/final_Code_Fix_004641  -DNDEBUG -DSunOS53 -D_POSIX_4SOURCES -I/usr/generic++/generic++2.5.3.64_bit/include  -DFEATURE_212298 -DBSCS_CONFIG -I/export/home/bscsobw/bscs6//src/bat/include -DFEATURE_00203808_GMD -DFEATURE_00241737  -DORACLE_DB_BRAND -I/u01/app/oracle/product/8.1.6/ORACLE_HOME/rdbms/demo -I/u01/app/oracle/product/8.1.6/ORACLE_HOME/precomp/public -I/export/home/bscsobw/bscs6/src/CoreDumpIssue/final_Code_Fix_004641/include -I../bat/include -DFEATURE61717 -DFEATURE52824 -DFEATURE56178 -DD236312_d -DSDP -g | sed -e 's/-I/INCLUDE=/g' -e 's/-D[^ ]=[^ ]*//g' -e 's/-D\([^ ]*\)/DEFINE=\1/g'` select_error=no   DEFINE=FEATURE61717 DEFINE=FEATURE52824 DEFINE=FEATURE56178 \
                lines=yes iname=bgh_esql.pc oname=bgh_esql.c lname=bgh_esql.lis
8
  • This is not Oracle PL/SQL code.
    – user272735
    Commented May 15, 2015 at 3:50
  • Sorry it was a mistake, this is the code segment from Pro-C. there is an intermittent behavior shown by "fnSQLMarkProcessed" procedure. Commented May 15, 2015 at 4:15
  • 1
    Please show the complete compiler command line. Commented May 18, 2015 at 15:04
  • Has O_rowid_stack and O_cust_processed been allocated/defined elsewhere??
    – TonyB
    Commented May 20, 2015 at 5:21
  • @TonyB: These are defined as the global variable VARCHAR O_rowid_stack[20]; /* current rowid on stack */ VARCHAR O_cust_processed[2]; Commented May 21, 2015 at 3:30

1 Answer 1

1

I think, you check this message:

[oracle@sb-rac02 ~]$ oerr sql 2115
02115, 00000, "Code interpretation problem -- check COMMON_NAME usage"
// *Cause: With PRO*FORTRAN, this error occurs if the precompiler option
//         COMMON_NAME is specified incorrectly.  **With other Oracle
//         Precompilers, this error occurs when the precompiler cannot
//         generate a section of code.**
// *Action: With Pro*FORTRAN, when using COMMON_NAME to precompile two or
//          more source modules, make sure to specify a different common name
//          for each module.  With other Oracle Precompilers, if the error
//          persists, call customer support for assistance.

So you can determine, that problem not in your variables.

Please, try use your code like this:

long fnSQLMarkProcessed (char *pszRowId, char *pszMarker)
{
  BGHCPY_TO_ORA (O_rowid_stack,    pszRowId);
  BGHCPY_TO_ORA (O_cust_processed, pszMarker);

  EXEC SQL UPDATE  document_all
          SET  processed_by_bgh = :O_cust_processed
        WHERE  rowid = :O_rowid_stack;

  return (sqlca.sqlcode);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.