gpt4 book ai didi

c++ - PRO*C 和 C++ 中的数据类型冲突

转载 作者:行者123 更新时间:2023-11-28 08:19:49 25 4
gpt4 key购买 nike

我是 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。

关于c++ - PRO*C 和 C++ 中的数据类型冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6265001/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com