Example of a delimited identifier
EXEC SQL prepare "%#!" from
'select customer_num from customer';
If you set DELIMIDENT, the SELECT string in the preceding PREPARE statement must be enclosed in quotation marks for the preprocessor to treat it as a string. If you enclose the statement in double quotation marks, the preprocessor treats it as an identifier.
"abc"
as
a cursor name, you must escape the initial quotation mark in the cursor
name: EXEC SQL BEGIN DECLARE SECTION;
char curname2[10];
char stmtname[10];
EXEC SQL END DECLARE SECTION;
stcopy("\"abc\"", curname2);
EXEC SQL declare :curname2 cursor for :stmtname;
- The backslash (\) is the C escape character. You need it to escape
the double quotation mark.
Without the escape character, the C compiler would interpret the double quotation mark as the end of the string.
- The cursor name must contain two double quotation marks.
The first double quotation mark escapes the double quotation mark and the second double quotation mark is the literal double quotation mark. The ANSI standard states that you cannot use a backslash to escape quotation marks. Instead, you must escape the quotation mark in the cursor name with another quotation mark.
Processor | After processing |
---|---|
ESQL/C preprocessor | \"\"abc |
C Compiler | ""abc |
ANSI-compliant database server | "abc |