Scope resolution and class member operators in C and C++ embedded SQL applications
You cannot use the
C++ scope resolution operator '::', nor the C and C++ member operators
'.' or '->' in embedded SQL statements.
You can easily accomplish the same thing through use of local
pointer or reference variables, which are set outside the SQL statement,
to point to the required scoped variable, then used inside the SQL
statement to refer to it. The following example shows the correct
method to use:
EXEC SQL BEGIN DECLARE SECTION;
char (& localName)[20] = ::name;
EXEC SQL END DECLARE SECTION;
EXEC SQL
SELECT name INTO :localName FROM STAFF
WHERE name = 'Sanders';