我是proc的新手,我将它与C++一起使用。
我可以连接到数据库。但在那之后,当我尝试激发一个查询时,它会给我一个错误。
代码:
EXEC SQL BEGIN DECLARE SECTION;
string custName=cusName;
long int custID=cusID;
EXEC SQL END DECLARE SECTION;
EXEC SQL insert into tbl_customer5 values(:custID,:custName)
错误:
Syntax error at line 42, column 4, file Customer.pc:
Error at line 42, column 4 in file Customer.pc
string custName=cusName;
...1
PCC-S-02201, Encountered the symbol "string" when expecting one of the following
:
auto, char, const, double, enum, extern, float, int, long,
ulong_varchar, OCIBFileLocator OCIBlobLocator,
OCIClobLocator, OCIDateTime, OCIExtProcContext, OCIInterval,
OCIRowid, OCIDate, OCINumber, OCIRaw, OCIString, register,
short, signed, sql_context, sql_cursor, static, struct,
typedef, union, unsigned, utext, uvarchar, varchar, void,
volatile, a typedef name, a precompiled header, exec oracle,
exec oracle begin, exec, exec sql, exec sql begin,
exec sql end, exec sql type, exec sql var, exec sql include,
The symbol "enum," was substituted for "string" to continue.
请告诉我如何解决此错误。在这种情况下,我们可以使用数据等价性吗?
如错误所示,"字符串"符号不存在。请尝试使用varchar。
它找不到字符串。
你可能需要std::在它的前面,或者您需要在Pro*C调用中添加include路径,以允许预处理器找到正确的include文件。还有其他Pro*C选项可以影响效果。
你能给我们看完整的makefile吗?