简体   繁体   English

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

[英]datatype conflicts in PRO*C and C++

I am new to proc and I am using it with C++.我是 proc 新手,我将它与 C++ 一起使用。

I am able to connect to the database.我能够连接到数据库。 But after that when I try to fire a query it gives me error.但在那之后,当我尝试触发查询时,它给了我错误。

CODE:代码:

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)

ERROR:错误:

   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.

Please tell me how to resolve this error.请告诉我如何解决此错误。 Can we use data equivalency in this case?在这种情况下我们可以使用数据等效性吗?

As the error indicates, the "string" symbol does not exist.如错误所示,“字符串”符号不存在。 Try to use varchar instead.尝试使用 varchar 代替。

It can't find string.它找不到字符串。

You may need std:: on the front of it, or you many need to add include paths to the Pro*C invocation to allow the preprocessor to find the correct include files.您可能需要 std:: 在它的前面,或者您需要在 Pro*C 调用中添加包含路径,以允许预处理器找到正确的包含文件。 There are other Pro*C options that can effect things.还有其他 Pro*C 选项可以影响事情。

Can you show us the whole makefile?你能告诉我们整个 makefile 吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM