Name the cursor

In the Informix® ESQL/C program, you can specify a cursor name with any of the following items:
  • A literal name must follow the rules for identifier names.
  • A delimited identifier is an identifier name that contains characters that do not conform to identifier-naming rules.
  • A dynamic cursor is a character host variable that contains the name of the cursor. This type of cursor specification means that the cursor name is specified dynamically by the value of the host variable. You can use a dynamic cursor in any SQL statement that allows a cursor name except the WHERE CURRENT OF clause of the DELETE or UPDATE statement.
    Dynamic cursors are useful to create generic functions to perform cursor-management tasks. You can pass in the name of the cursor as an argument to the function. If the cursor name is to be used in the Informix® ESQL/C statement within the function, make sure that you declare the argument as a host variable with the PARAMETER keyword. The following code fragment shows a generic cursor deallocation function called remove_curs().
    void remove_curs(cursname)
    EXEC SQL BEGIN DECLARE SECTION;
       PARAMETER char *cursname;
    EXEC SQL END DECLARE SECTION;
    {
       EXEC SQL close :cursname;
       EXEC SQL free :cursname;
    }