Case sensitivity in embedded SQL statements

The following table describes how the preprocessor treats uppercase and lowercase letters.
Table 1. Case sensitivity in ESQL/C files
ESQL/C identifier Case sensitive Example
Host variable Yes treats the variables fname and Fname as distinct variables:
EXEC SQL BEGIN DECLARE SECTION;
  char fname[16], lname[16];
  char Fname[16];
EXEC SQL END DECLARE SECTION;

This sample does not generate a warning from the preprocessor.

Variable types Yes Both and C treat the names of data types as case sensitive. The CHAR type in the following example is considered distinct from the char data type and it generates an error:
EXEC SQL BEGIN DECLARE SECTION;
  char fname[16], lname[16];
  CHAR Fname[16];
EXEC SQL END DECLARE SECTION;
The CHAR type does not generate an error, however, if you provide a typedef statement for it. In the following example, the CHAR type does not generate an error:
typedef char CHAR;

EXEC SQL BEGIN DECLARE SECTION;
  char fname[16], lname[16];
  CHAR Fname[16];
EXEC SQL END DECLARE SECTION;
SQL keyword No Both CONNECT statements are valid ways of establishing a connection to the stores7 demonstration database:
EXEC SQL CONNECT TO 'stores7';
or
EXEC SQL connect to 'stores7';

In examples given in this publication, SQL keywords are displayed as lowercase characters.

Statement identifiers

Cursor names

No The following example shows the creation of statement IDs and cursor names:
EXEC SQL prepare st from 
    'select * from tab1';
/* duplicate */
EXEC SQL prepare ST from
    'insert into tab2 
     values (1,2)';
EXEC SQL declare curname cursor
    for st;
/* duplicate */
EXEC SQL declare CURNAME cursor 
    for ST;

This code produces errors because the statement IDs st and ST are duplicates, as are the cursor names curname and CURNAME. For more information about statement IDs and cursor names, see the HCL OneDB™ Guide to SQL: Syntax.