BUG: ESQL: IN Clause in Cursor Causes Error

Last reviewed: May 5, 1997
Article ID: Q87310

The information in this article applies to:
  • Microsoft Embedded SQL version 4.2 for COBOL
BUG# ESQL: 7318 (4.2)

SYMPTOMS

In an Embedded SQL for COBOL application, if the declaration of a cursor contains an IN clause and you use host variables as the list values, the following error occurs when you compile the application:

   Error 102: syntax error near "<cursor name>"

For example, this cursor declaration causes the error:

   exec sql
      declare c cursor for
      select * from authors
      where au_id in (:id1,:id2,:id3)
   end-exec

CAUSE

SQL Server Embedded SQL for COBOL incorrectly parses the IN clause in a cursor declaration if you use host variables as the list values.

WORKAROUND

Because there are a finite number of host variables in the value list, you can convert the IN clause into several OR statements. For example, the query above can be converted into the following:

   where au_id=:id1
   OR    au_id=:id2
   OR    au_id=:id3

STATUS

Microsoft has confirmed this to be a problem in SQL Server Embedded SQL for COBOL version 4.2. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Additional query words:
Keywords : kbbug4.20 kbprg SSrvCobol SSrvProg
Version : 4.2
Platform : OS/2


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 5, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.