Title: Dynamic SQL problem (Oracle 9<->8)

Hello,

I have software compiled in Oracle 9 environment. And when I try to fetch data using
different versions of Oracle client/server I receive ORA-errors:

1. client 9 --> server 8: "ORA-00932: inconsistent datatypes"
2. client 8 --> server 9: "ORA-01455: converting column overflows integer datatype"

These errors do not occur when connecting client 9 to server 9.

I use the following example code (similar to example in Oracle 9 documentation):

      EXEC SQL BEGIN DECLARE SECTION;
         int     intn_b;
         VARCHAR buffer[6];
         VARCHAR cursor_def[500];
      EXEC SQL END DECLARE SECTION;

      strcpy((char*)cursor_def.arr, "SELECT tstintn,tstcode FROM test WHERE tstcode LIKE 'AU%'");
      cursor_def.len = strlen((char*)cursor_def.arr);

      EXEC SQL PREPARE S FROM :cursor_def;
      EXEC SQL DECLARE My_cursor CURSOR FOR S;
      EXEC SQL OPEN My_cursor ;
      EXEC SQL WHENEVER NOT FOUND DO break;

      for (;;)
      {
         int i=0;
         EXEC SQL FETCH My_cursor INTO :intn_b, :buffer;
         buffer.arr[buffer.len] = '\0';
         printf("%6d %7s\n", intn_b, buffer.arr);
      }
      EXEC SQL CLOSE My_cursor;


When I declare cursor without using dynamic SQL:

EXEC SQL DECLARE My_cursor CURSOR FOR
       SELECT tstintn, tstcode FROM test WHERE tstcode LIKE 'AU%';

everything works fine.


Does anyone know how to solve this problem?

Regards,
Rafal Wojnar
e-mail: [EMAIL PROTECTED]

Reply via email to