Fetching Cursors that have Keywords as Names
In a few situations, no workaround exists for the syntactic ambiguity that occurs when a keyword is used as an identifier in an SQL program.
In the following example, the FETCH statement specifies a cursor
named next. The FETCH statement generates a syntax error because
the preprocessor interprets next as a keyword, signifying the
next row in the active set and expects a cursor name to follow next.
This occurs whenever the keyword NEXT, PREVIOUS, PRIOR, FIRST, LAST,
CURRENT, RELATIVE, or ABSOLUTE is used as a cursor name:
/* This code fragment fails */ EXEC SQL declare next cursor for select customer_num, lname from customer; EXEC SQL open next; EXEC SQL fetch next into :cnum, :lname;